-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable PlanResourceChange by default for every resource in the provider. This pulumi-terraform-bridge feature was incubated under a flag and deployed selectively or quite some time. It should be ready to become the new default. Improvements include prevention of panics and undesirable plans such as permanent diff cycling, as the flow is brought more in line with how TF operates the provider e.g. the expected behavior. --------- Co-authored-by: Venelin <[email protected]> Co-authored-by: VenelinMartinov <[email protected]>
- Loading branch information
1 parent
290c8c3
commit 3ff4fa4
Showing
7 changed files
with
160 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
patches/0066-Legacy-bucket-Read-now-sets-acl-and-force_destroy-de.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Anton Tayanovskyy <[email protected]> | ||
Date: Thu, 29 Aug 2024 13:17:47 -0400 | ||
Subject: [PATCH] Legacy bucket Read now sets acl and force_destroy defaults | ||
|
||
|
||
diff --git a/internal/service/s3legacy/bucket_legacy.go b/internal/service/s3legacy/bucket_legacy.go | ||
index d5c03b22fb..8c26fee574 100644 | ||
--- a/internal/service/s3legacy/bucket_legacy.go | ||
+++ b/internal/service/s3legacy/bucket_legacy.go | ||
@@ -35,6 +35,10 @@ import ( | ||
"github.com/hashicorp/terraform-provider-aws/internal/verify" | ||
) | ||
|
||
+const ( | ||
+ bucketACLDefaultValue = "private" | ||
+) | ||
+ | ||
func ResourceBucketLegacy() *schema.Resource { | ||
return &schema.Resource{ | ||
CreateWithoutTimeout: resourceBucketLegacyCreate, | ||
@@ -80,7 +84,7 @@ func ResourceBucketLegacy() *schema.Resource { | ||
|
||
"acl": { | ||
Type: schema.TypeString, | ||
- Default: "private", | ||
+ Default: bucketACLDefaultValue, | ||
Optional: true, | ||
ConflictsWith: []string{"grant"}, | ||
ValidateFunc: validation.StringInSlice(BucketCannedACL_Values(), false), | ||
@@ -943,7 +947,7 @@ func resourceBucketLegacyRead(ctx context.Context, d *schema.ResourceData, meta | ||
} | ||
|
||
//Read the Grant ACL. Reset if `acl` (canned ACL) is set. | ||
- if acl, ok := d.GetOk("acl"); ok && acl.(string) != "private" { | ||
+ if acl, ok := d.GetOk("acl"); ok && acl.(string) != bucketACLDefaultValue { | ||
if err := d.Set("grant", nil); err != nil { | ||
return diag.Errorf("error resetting grant %s", err) | ||
} | ||
@@ -1403,6 +1407,18 @@ func resourceBucketLegacyRead(ctx context.Context, d *schema.ResourceData, meta | ||
}.String() | ||
d.Set("arn", arn) | ||
|
||
+ // Set ACL default if unset, this fixes resource import option operation under Pulumi. | ||
+ _, gotGrant := d.GetOk("grant") | ||
+ _, gotACL := d.GetOk("acl") | ||
+ if !gotGrant && !gotACL { | ||
+ d.Set("acl", bucketACLDefaultValue) | ||
+ } | ||
+ | ||
+ // Similarly, set force_destroy to default value if unset, to fix resource import operation. | ||
+ if _, fdSet := d.GetOk("force_destroy"); !fdSet { | ||
+ d.Set("force_destroy", false) | ||
+ } | ||
+ | ||
return nil | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.