Skip to content

Commit f63039f

Browse files
committed
feat: Expose enableAutoattach fields for aws and azure integrations
1 parent 6503dcc commit f63039f

20 files changed

+70
-9
lines changed

docs/data-sources/aws_integration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ data "spacelift_aws_integration" "example" {
3838

3939
### Read-Only
4040

41+
- `autoattach_enabled` (Boolean) Enables `autoattach:` labels functionality for this integration.
4142
- `duration_seconds` (Number) Duration in seconds for which the assumed role credentials should be valid
4243
- `external_id` (String) Custom external ID (works only for private workers).
4344
- `generate_credentials_in_worker` (Boolean) Generate AWS credentials in the private worker

docs/data-sources/aws_integrations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ description: |-
2929

3030
Read-Only:
3131

32+
- `autoattach_enabled` (Boolean)
3233
- `duration_seconds` (Number)
3334
- `external_id` (String)
3435
- `generate_credentials_in_worker` (Boolean)

docs/data-sources/azure_integration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ data "spacelift_azure_integration" "example" {
3737
- `admin_consent_provided` (Boolean) Indicates whether admin consent has been performed for the AAD Application.
3838
- `admin_consent_url` (String) The URL to use to provide admin consent to the application in the customer's tenant
3939
- `application_id` (String) The applicationId of the Azure AD application used by the integration.
40+
- `autoattach_enabled` (Boolean) Enables `autoattach:` labels functionality for this integration.
4041
- `default_subscription_id` (String) The default subscription ID to use, if one isn't specified at the stack/module level
4142
- `display_name` (String) The display name for the application in Azure. This is automatically generated when the integration is created, and cannot be changed without deleting and recreating the integration.
4243
- `id` (String) The ID of this resource.

docs/data-sources/azure_integrations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Read-Only:
2828
- `admin_consent_provided` (Boolean)
2929
- `admin_consent_url` (String)
3030
- `application_id` (String)
31+
- `autoattach_enabled` (Boolean)
3132
- `default_subscription_id` (String)
3233
- `display_name` (String)
3334
- `integration_id` (String)

docs/resources/aws_integration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ resource "spacelift_aws_integration_attachment" "my_module" {
103103

104104
### Optional
105105

106+
- `autoattach_enabled` (Boolean) Enables `autoattach:` labels functionality for this integration.
106107
- `duration_seconds` (Number) Duration in seconds for which the assumed role credentials should be valid. Defaults to `900`.
107108
- `external_id` (String) Custom external ID (works only for private workers).
108109
- `generate_credentials_in_worker` (Boolean) Generate AWS credentials in the private worker. Defaults to `false`.

docs/resources/azure_integration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ resource "spacelift_azure_integration" "example" {
3131

3232
### Optional
3333

34+
- `autoattach_enabled` (Boolean) Enables `autoattach:` labels functionality for this integration.
3435
- `default_subscription_id` (String) The default subscription ID to use, if one isn't specified at the stack/module level
3536
- `labels` (Set of String) Labels to set on the integration
3637
- `space_id` (String) ID (slug) of the space the integration is in

spacelift/data_aws_integration.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ func dataAWSIntegration() *schema.Resource {
7878
Elem: &schema.Schema{Type: schema.TypeString},
7979
Computed: true,
8080
},
81+
"autoattach_enabled": {
82+
Type: schema.TypeBool,
83+
Description: "Enables `autoattach:` labels functionality for this integration.",
84+
Computed: true,
85+
},
8186
},
8287
}
8388
}

spacelift/data_aws_integration_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func TestAWSIntegrationData(t *testing.T) {
2222
labels = ["one", "two"]
2323
duration_seconds = 3600
2424
generate_credentials_in_worker = false
25+
autoattach_enabled = true
2526
}
2627
2728
data "spacelift_aws_integration" "test" {
@@ -36,6 +37,7 @@ func TestAWSIntegrationData(t *testing.T) {
3637
Attribute("generate_credentials_in_worker", Equals("false")),
3738
Attribute("name", Equals(fmt.Sprintf("test-aws-integration-%s", randomID))),
3839
SetEquals("labels", "one", "two"),
40+
Attribute("autoattach_enabled", Equals("true")),
3941
),
4042
}})
4143
})

spacelift/data_aws_integrations.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ func dataAWSIntegrations() *schema.Resource {
7171
Description: "AWS region to select a regional AWS STS endpoint.",
7272
Computed: true,
7373
},
74+
"autoattach_enabled": {
75+
Type: schema.TypeBool,
76+
Description: "Enables `autoattach:` labels functionality for this integration.",
77+
Computed: true,
78+
},
7479
},
7580
},
7681
},

spacelift/data_aws_integrations_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func TestAWSIntegrationsData(t *testing.T) {
2020
Name: acctest.RandStringFromCharSet(5, acctest.CharSetAlpha),
2121
RoleARN: "arn:aws:iam::039653571618:role/empty-test-role",
2222
Space: "root",
23+
AutoattachEnabled: true,
2324
}
2425
second := &structs.AWSIntegration{
2526
DurationSeconds: 4321,
@@ -107,9 +108,10 @@ func awsIntegrationToResource(i *structs.AWSIntegration) string {
107108
labels = %s
108109
duration_seconds = %d
109110
generate_credentials_in_worker = %t
111+
autoattach_enabled = %t
110112
%s
111113
}
112-
`, i.Name, i.Name, i.RoleARN, i.Space, labelsAsString(i.Labels), i.DurationSeconds, i.GenerateCredentialsInWorker, regionAttr)
114+
`, i.Name, i.Name, i.RoleARN, i.Space, labelsAsString(i.Labels), i.DurationSeconds, i.GenerateCredentialsInWorker, i.AutoattachEnabled, regionAttr)
113115
}
114116

115117
func labelsAsString(labels []string) string {
@@ -124,6 +126,7 @@ func awsIntegrationChecks(i *structs.AWSIntegration) []resource.TestCheckFunc {
124126
Attribute("space_id", Equals(i.Space)),
125127
Attribute("duration_seconds", Equals(fmt.Sprintf("%d", i.DurationSeconds))),
126128
Attribute("generate_credentials_in_worker", Equals(fmt.Sprintf("%t", i.GenerateCredentialsInWorker))),
129+
Attribute("autoattach_enabled", Equals(fmt.Sprintf("%t", i.AutoattachEnabled))),
127130
SetEquals("labels", i.Labels...),
128131
}
129132
if i.Region != nil {

0 commit comments

Comments
 (0)