-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resource/aws_iam_user_policy: Fix updates with generated policy names and validate JSON #3031
Conversation
… and validate JSON This also refactors the acceptance testing to check attributes and reuse test configurations.
aws/resource_aws_iam_user_policy.go
Outdated
@@ -57,7 +59,9 @@ func resourceAwsIamUserPolicyPut(d *schema.ResourceData, meta interface{}) error | |||
} | |||
|
|||
var policyName string | |||
if v, ok := d.GetOk("name"); ok { | |||
if d.Id() != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: For folks who're not familiar with the significance of ID so using !d.IsNewResource()
may be easier to understand for the reader here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly easier to grok! Works like a charm 🚀
make testacc TEST=./aws TESTARGS='-run=TestAccAWSIAMUserPolicy'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSIAMUserPolicy -timeout 120m
=== RUN TestAccAWSIAMUserPolicy_basic
--- PASS: TestAccAWSIAMUserPolicy_basic (15.01s)
=== RUN TestAccAWSIAMUserPolicy_namePrefix
--- PASS: TestAccAWSIAMUserPolicy_namePrefix (15.87s)
=== RUN TestAccAWSIAMUserPolicy_generatedName
--- PASS: TestAccAWSIAMUserPolicy_generatedName (12.56s)
=== RUN TestAccAWSIAMUserPolicy_multiplePolicies
--- PASS: TestAccAWSIAMUserPolicy_multiplePolicies (26.00s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 69.492s
…d.Id() value for readability
This has been released in terraform-provider-aws version 1.7.1. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Replaces bugfix portions of #2450
Closes #781
This also refactors the acceptance testing to check attributes, test policy updates for name/name_prefix/generated names, and starts to reuse test configurations where possible (e.g
testAccAWSUserConfig
fromaws_iam_user
tests).