-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Prevent importing Organization policy #15446
Conversation
…tAccCheckResourceDisappears Reference: #15446
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.
Please reach out if you have any questions.
} | ||
|
||
func resourceAwsOrganizationsPolicyRead(d *schema.ResourceData, meta interface{}) error { | ||
func resourceAwsOrganizationsPolicyRead(ctx context.Context, d *schema.ResourceData, meta interface{}) (diags diag.Diagnostics) { |
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.
Since this is the first introduction of context-aware resource functions, we will want to set a good standard. 😄
Recommendations in Go's tutorial and Go's Code Review Comments suggest to only use named result parameters in shorter number of line functions or if there is ambiguity between multiple return values of the same type. To prevent this going forward we can fix the reports and enable the nakedret
linter in golangci-lint.
For functions that want to build multiple diagnostics before returning, they can instantiate a var diags diag.Diagnostics
. 👍
func resourceAwsOrganizationsPolicyRead(ctx context.Context, d *schema.ResourceData, meta interface{}) (diags diag.Diagnostics) { | |
func resourceAwsOrganizationsPolicyRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { |
@@ -0,0 +1 @@ | |||
0.13.4 |
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.
This new testing is nice because its covering this very specific scenario, but I have a few concerns:
- This testing is outside of currently automated test runs (when would this get run again? when should it?)
- This new directory structure and testing style is not self-documented, in the contributing/maintaining guide, or in the Extending Terraform documentation (when should this be used? why is this here?)
- Introduces a new maintenance burden of maintaining a Terraform version here (is the version number significant? should it instead be in the configuration as
required_version = ">= 0.12"
?)
I think we should probably work through some of these before introducing it into the codebase.
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.
For sure. I included it here essentially to "show my work" with testing the change. I expected it to be iterated on before becoming something official. I'll pull it out and make a WIP proposal
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.
Otherwise, looks good 🚀
Output from acceptance testing:
--- PASS: TestAccAWSOrganizations_serial/Policy (313.22s)
--- PASS: TestAccAWSOrganizations_serial/Policy/concurrent (32.45s)
--- PASS: TestAccAWSOrganizations_serial/Policy/Type_AI_OPT_OUT (22.80s)
--- PASS: TestAccAWSOrganizations_serial/Policy/Type_Backup (22.51s)
--- PASS: TestAccAWSOrganizations_serial/Policy/Type_Tag (23.26s)
--- SKIP: TestAccAWSOrganizations_serial/Policy/ImportAwsManagedPolicy (0.00s)
--- PASS: TestAccAWSOrganizations_serial/Policy/basic (38.80s)
--- PASS: TestAccAWSOrganizations_serial/Policy/Description (39.69s)
--- PASS: TestAccAWSOrganizations_serial/Policy/Tags (76.30s)
--- PASS: TestAccAWSOrganizations_serial/Policy/disappears (19.64s)
--- PASS: TestAccAWSOrganizations_serial/Policy/Type_SCP (37.78s)
--- PASS: TestAccAWSOrganizations_serial/PolicyAttachment (103.45s)
--- PASS: TestAccAWSOrganizations_serial/PolicyAttachment/Account (47.89s)
--- PASS: TestAccAWSOrganizations_serial/PolicyAttachment/OrganizationalUnit (28.38s)
--- PASS: TestAccAWSOrganizations_serial/PolicyAttachment/Root (27.18s)
Co-authored-by: Brian Flad <bflad417@gmail.com>
This has been released in version 3.10.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
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! |
Prevent importing Organization policy
Closes #15397
Release note for CHANGELOG:
Output from acceptance testing: