Skip to content

Commit 98512a4

Browse files
committed
remaining vendors
1 parent 69dee53 commit 98512a4

File tree

2 files changed

+52
-8
lines changed

2 files changed

+52
-8
lines changed

spacelift/internal/structs/stack.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,21 @@ func (s *Stack) VCSSettings() (string, map[string]interface{}) {
136136
switch s.Provider {
137137
case VCSProviderAzureDevOps:
138138
return "azure_devops", map[string]interface{}{
139-
"id": s.VCSIntegration.ID,
140-
"project": s.Namespace,
139+
"id": s.VCSIntegration.ID,
140+
"project": s.Namespace,
141+
"is_default": s.VCSIntegration.IsDefault,
141142
}
142143
case VCSProviderBitbucketCloud:
143144
return "bitbucket_cloud", map[string]interface{}{
144-
"id": s.VCSIntegration.ID,
145-
"namespace": s.Namespace,
145+
"id": s.VCSIntegration.ID,
146+
"namespace": s.Namespace,
147+
"is_default": s.VCSIntegration.IsDefault,
146148
}
147149
case VCSProviderBitbucketDatacenter:
148150
return "bitbucket_datacenter", map[string]interface{}{
149-
"id": s.VCSIntegration.ID,
150-
"namespace": s.Namespace,
151+
"id": s.VCSIntegration.ID,
152+
"namespace": s.Namespace,
153+
"is_default": s.VCSIntegration.IsDefault,
151154
}
152155
case VCSProviderGitHubEnterprise:
153156
return "github_enterprise", map[string]interface{}{
@@ -157,8 +160,9 @@ func (s *Stack) VCSSettings() (string, map[string]interface{}) {
157160
}
158161
case VCSProviderGitlab:
159162
return "gitlab", map[string]interface{}{
160-
"id": s.VCSIntegration.ID,
161-
"namespace": s.Namespace,
163+
"id": s.VCSIntegration.ID,
164+
"namespace": s.Namespace,
165+
"is_default": s.VCSIntegration.IsDefault,
162166
}
163167
case VCSProviderRawGit:
164168
return "raw_git", map[string]interface{}{

spacelift/resource_stack.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,23 @@ func resourceStack() *schema.Resource {
141141
Type: schema.TypeString,
142142
Optional: true,
143143
Description: "The ID of the Azure Devops integration. If not specified, the default integration will be used.",
144+
DiffSuppressFunc: func(_, _, new string, res *schema.ResourceData) bool {
145+
isDefault := res.Get("azure_devops.0.is_default").(bool)
146+
147+
return isDefault && new == ""
148+
},
144149
},
145150
"project": {
146151
Type: schema.TypeString,
147152
Required: true,
148153
Description: "The name of the Azure DevOps project",
149154
ValidateDiagFunc: validations.DisallowEmptyString,
150155
},
156+
"is_default": {
157+
Type: schema.TypeBool,
158+
Computed: true,
159+
Description: "Indicates whether this is the default Azure DevOps integration",
160+
},
151161
},
152162
},
153163
},
@@ -214,13 +224,23 @@ func resourceStack() *schema.Resource {
214224
Type: schema.TypeString,
215225
Optional: true,
216226
Description: "The ID of the Bitbucket Cloud integration. If not specified, the default integration will be used.",
227+
DiffSuppressFunc: func(_, _, new string, res *schema.ResourceData) bool {
228+
isDefault := res.Get("bitbucket_cloud.0.is_default").(bool)
229+
230+
return isDefault && new == ""
231+
},
217232
},
218233
"namespace": {
219234
Type: schema.TypeString,
220235
Required: true,
221236
Description: "The Bitbucket project containing the repository",
222237
ValidateDiagFunc: validations.DisallowEmptyString,
223238
},
239+
"is_default": {
240+
Type: schema.TypeBool,
241+
Computed: true,
242+
Description: "Indicates whether this is the default Bitbucket Cloud integration",
243+
},
224244
},
225245
},
226246
},
@@ -236,13 +256,23 @@ func resourceStack() *schema.Resource {
236256
Type: schema.TypeString,
237257
Optional: true,
238258
Description: "The ID of the Bitbucket Datacenter integration. If not specified, the default integration will be used.",
259+
DiffSuppressFunc: func(_, _, new string, res *schema.ResourceData) bool {
260+
isDefault := res.Get("bitbucket_datacenter.0.is_default").(bool)
261+
262+
return isDefault && new == ""
263+
},
239264
},
240265
"namespace": {
241266
Type: schema.TypeString,
242267
Required: true,
243268
Description: "The Bitbucket project containing the repository",
244269
ValidateDiagFunc: validations.DisallowEmptyString,
245270
},
271+
"is_default": {
272+
Type: schema.TypeBool,
273+
Computed: true,
274+
Description: "Indicates whether this is the default Bitbucket Datacenter integration",
275+
},
246276
},
247277
},
248278
},
@@ -342,13 +372,23 @@ func resourceStack() *schema.Resource {
342372
Type: schema.TypeString,
343373
Optional: true,
344374
Description: "The ID of the Gitlab integration. If not specified, the default integration will be used.",
375+
DiffSuppressFunc: func(_, _, new string, res *schema.ResourceData) bool {
376+
isDefault := res.Get("gitlab.0.is_default").(bool)
377+
378+
return isDefault && new == ""
379+
},
345380
},
346381
"namespace": {
347382
Type: schema.TypeString,
348383
Required: true,
349384
Description: "The GitLab namespace containing the repository",
350385
ValidateDiagFunc: validations.DisallowEmptyString,
351386
},
387+
"is_default": {
388+
Type: schema.TypeBool,
389+
Computed: true,
390+
Description: "Indicates whether this is the default GitLab integration",
391+
},
352392
},
353393
},
354394
},

0 commit comments

Comments
 (0)