Skip to content

Commit

Permalink
remaining vendors
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMacies committed Feb 6, 2024
1 parent 69dee53 commit 98512a4
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 8 deletions.
20 changes: 12 additions & 8 deletions spacelift/internal/structs/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,21 @@ func (s *Stack) VCSSettings() (string, map[string]interface{}) {
switch s.Provider {
case VCSProviderAzureDevOps:
return "azure_devops", map[string]interface{}{
"id": s.VCSIntegration.ID,
"project": s.Namespace,
"id": s.VCSIntegration.ID,
"project": s.Namespace,
"is_default": s.VCSIntegration.IsDefault,
}
case VCSProviderBitbucketCloud:
return "bitbucket_cloud", map[string]interface{}{
"id": s.VCSIntegration.ID,
"namespace": s.Namespace,
"id": s.VCSIntegration.ID,
"namespace": s.Namespace,
"is_default": s.VCSIntegration.IsDefault,
}
case VCSProviderBitbucketDatacenter:
return "bitbucket_datacenter", map[string]interface{}{
"id": s.VCSIntegration.ID,
"namespace": s.Namespace,
"id": s.VCSIntegration.ID,
"namespace": s.Namespace,
"is_default": s.VCSIntegration.IsDefault,
}
case VCSProviderGitHubEnterprise:
return "github_enterprise", map[string]interface{}{
Expand All @@ -157,8 +160,9 @@ func (s *Stack) VCSSettings() (string, map[string]interface{}) {
}
case VCSProviderGitlab:
return "gitlab", map[string]interface{}{
"id": s.VCSIntegration.ID,
"namespace": s.Namespace,
"id": s.VCSIntegration.ID,
"namespace": s.Namespace,
"is_default": s.VCSIntegration.IsDefault,
}
case VCSProviderRawGit:
return "raw_git", map[string]interface{}{
Expand Down
40 changes: 40 additions & 0 deletions spacelift/resource_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,23 @@ func resourceStack() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Description: "The ID of the Azure Devops integration. If not specified, the default integration will be used.",
DiffSuppressFunc: func(_, _, new string, res *schema.ResourceData) bool {
isDefault := res.Get("azure_devops.0.is_default").(bool)

return isDefault && new == ""
},
},
"project": {
Type: schema.TypeString,
Required: true,
Description: "The name of the Azure DevOps project",
ValidateDiagFunc: validations.DisallowEmptyString,
},
"is_default": {
Type: schema.TypeBool,
Computed: true,
Description: "Indicates whether this is the default Azure DevOps integration",
},
},
},
},
Expand Down Expand Up @@ -214,13 +224,23 @@ func resourceStack() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Description: "The ID of the Bitbucket Cloud integration. If not specified, the default integration will be used.",
DiffSuppressFunc: func(_, _, new string, res *schema.ResourceData) bool {
isDefault := res.Get("bitbucket_cloud.0.is_default").(bool)

return isDefault && new == ""
},
},
"namespace": {
Type: schema.TypeString,
Required: true,
Description: "The Bitbucket project containing the repository",
ValidateDiagFunc: validations.DisallowEmptyString,
},
"is_default": {
Type: schema.TypeBool,
Computed: true,
Description: "Indicates whether this is the default Bitbucket Cloud integration",
},
},
},
},
Expand All @@ -236,13 +256,23 @@ func resourceStack() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Description: "The ID of the Bitbucket Datacenter integration. If not specified, the default integration will be used.",
DiffSuppressFunc: func(_, _, new string, res *schema.ResourceData) bool {
isDefault := res.Get("bitbucket_datacenter.0.is_default").(bool)

return isDefault && new == ""
},
},
"namespace": {
Type: schema.TypeString,
Required: true,
Description: "The Bitbucket project containing the repository",
ValidateDiagFunc: validations.DisallowEmptyString,
},
"is_default": {
Type: schema.TypeBool,
Computed: true,
Description: "Indicates whether this is the default Bitbucket Datacenter integration",
},
},
},
},
Expand Down Expand Up @@ -342,13 +372,23 @@ func resourceStack() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Description: "The ID of the Gitlab integration. If not specified, the default integration will be used.",
DiffSuppressFunc: func(_, _, new string, res *schema.ResourceData) bool {
isDefault := res.Get("gitlab.0.is_default").(bool)

return isDefault && new == ""
},
},
"namespace": {
Type: schema.TypeString,
Required: true,
Description: "The GitLab namespace containing the repository",
ValidateDiagFunc: validations.DisallowEmptyString,
},
"is_default": {
Type: schema.TypeBool,
Computed: true,
Description: "Indicates whether this is the default GitLab integration",
},
},
},
},
Expand Down

0 comments on commit 98512a4

Please sign in to comment.