diff --git a/spacelift/resource_aws_integration_attachment.go b/spacelift/resource_aws_integration_attachment.go index 2be03c63..bff1526f 100644 --- a/spacelift/resource_aws_integration_attachment.go +++ b/spacelift/resource_aws_integration_attachment.go @@ -152,7 +152,7 @@ func resourceAWSIntegrationAttachmentRead(ctx context.Context, d *schema.Resourc func resourceAWSIntegrationAttachmentUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var mutation struct { - awsIntegrationAttachmentUpdate structs.AWSIntegrationAttachment `graphql:"awsIntegrationAttachmentUpdate(id: $id, read: $read, write: $write)"` + AWSIntegrationAttachmentUpdate structs.AWSIntegrationAttachment `graphql:"awsIntegrationAttachmentUpdate(id: $id, read: $read, write: $write)"` } variables := map[string]interface{}{ diff --git a/spacelift/resource_aws_integration_attachment_test.go b/spacelift/resource_aws_integration_attachment_test.go index a368af62..27eb37e0 100644 --- a/spacelift/resource_aws_integration_attachment_test.go +++ b/spacelift/resource_aws_integration_attachment_test.go @@ -83,4 +83,63 @@ func TestAWSIntegrationAttachmentResource(t *testing.T) { }, }) }) + + t.Run("update attachment", func(t *testing.T) { + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + + testSteps(t, []resource.TestStep{ + { + Config: fmt.Sprintf(` + resource "spacelift_stack" "test" { + branch = "master" + repository = "demo" + name = "Test stack %s" + } + + resource "spacelift_aws_integration" "test" { + name = "test-aws-integration-%s" + role_arn = "arn:aws:iam::039653571618:role/empty-test-role" + generate_credentials_in_worker = false + } + + resource "spacelift_aws_integration_attachment" "test" { + stack_id = spacelift_stack.test.id + integration_id = spacelift_aws_integration.test.id + read = true + write = false + } + `, randomID, randomID), + Check: Resource( + resourceName, + Attribute("write", Equals("false")), + ), + }, + { + Config: fmt.Sprintf(` + resource "spacelift_stack" "test" { + branch = "master" + repository = "demo" + name = "Test stack %s" + } + + resource "spacelift_aws_integration" "test" { + name = "test-aws-integration-%s" + role_arn = "arn:aws:iam::039653571618:role/empty-test-role" + generate_credentials_in_worker = false + } + + resource "spacelift_aws_integration_attachment" "test" { + stack_id = spacelift_stack.test.id + integration_id = spacelift_aws_integration.test.id + read = true + write = true + } + `, randomID, randomID), + Check: Resource( + resourceName, + Attribute("write", Equals("true")), + ), + }, + }) + }) }