Skip to content
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

r/aws_config_organization_custom_policy_rule: New resource #28201

Merged
merged 7 commits into from
Apr 25, 2023
Merged

r/aws_config_organization_custom_policy_rule: New resource #28201

merged 7 commits into from
Apr 25, 2023

Conversation

georgealton
Copy link
Contributor

@georgealton georgealton commented Dec 5, 2022

Description

This adds a new resource aws_config_organization_custom_policy_rule

AWS Config Rules added the capability to use a CloudFormation Guard Policy as a declarative way of performing assertions against resource configuration, without having to manage a Lambda Function.

The Provider gained the capability to manage Account Level CFN Guard Policy backed Rules, but not learn this for Organization Config Rules.

This PR adds the Organization Rule Resource, allowing a team to easily apply a policy to an entire organization, without having to manage and deploy Lambda functions to many accounts.

This feature is really useful for central enabling teams looking to validate best practice compliance in a multi AWS account, high autonomy, organization.

Relations

Closes #27987
Closes #26989

References

API Docs: https://docs.aws.amazon.com/config/latest/APIReference/API_PutOrganizationConfigRule.html
Related Config Rule Resource: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/config_config_rule#custom-policy-details

Output from Acceptance Testing

It was tricky to get all the Acceptance tests to pass together, there is some eventual consistency between organizations and config that sometimes in resulted in AWS Config reporting that the account wasn't a member of an Organization. This might be addressable with more thought on #11582

make testacc TESTS='TestAccConfigServiceOrganizationCustomPolicyRule' PKG=configservice
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/configservice/... -v -count 1 -parallel 20 -run='TestAccConfigServiceOrganizationCustomPolicyRule'  -timeout 180m
=== RUN   TestAccConfigServiceOrganizationCustomPolicyRule_basic
--- PASS: TestAccConfigServiceOrganizationCustomPolicyRule_basic (267.03s)
=== RUN   TestAccConfigServiceOrganizationCustomPolicyRule_disappears
--- PASS: TestAccConfigServiceOrganizationCustomPolicyRule_disappears (246.83s)
=== RUN   TestAccConfigServiceOrganizationCustomPolicyRule_PolicyText
--- PASS: TestAccConfigServiceOrganizationCustomPolicyRule_PolicyText (386.49s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/configservice	905.497s

@github-actions
Copy link

github-actions bot commented Dec 5, 2022

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/configservice Issues and PRs that pertain to the configservice service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/XL Managed by automation to categorize the size of a PR. and removed documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/configservice Issues and PRs that pertain to the configservice service. provider Pertains to the provider itself, rather than any interaction with AWS. labels Dec 5, 2022
@georgealton georgealton changed the title wip [WIP] r/aws_config_organization_custom_policy_rule: New resource Dec 5, 2022
@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/configservice Issues and PRs that pertain to the configservice service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Dec 5, 2022
@georgealton georgealton changed the title [WIP] r/aws_config_organization_custom_policy_rule: New resource r/aws_config_organization_custom_policy_rule: New resource Dec 6, 2022
@georgealton georgealton marked this pull request as ready for review December 7, 2022 09:39
Copy link

@glenthomas glenthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@justinretzolk justinretzolk added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 6, 2023
@github-actions github-actions bot removed the provider Pertains to the provider itself, rather than any interaction with AWS. label Mar 4, 2023
@gpetrovgeorgi
Copy link

Hello guys, when we could expect this PR to be merged ? My organization is looking for this exact solution at the moment. Thank you in advance.

@github-actions github-actions bot added the generators Relates to code generators. label Mar 16, 2023
@georgealton
Copy link
Contributor Author

georgealton commented Mar 22, 2023

Hello guys, when we could expect this PR to be merged ? My organization is looking for this exact solution at the moment. Thank you in advance.

@gpetrovgeorgi You've encouraged me to get the tests passing again :)

Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀.

@ewbankkit
Copy link
Contributor

@georgealton Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 9bd7065 into hashicorp:main Apr 25, 2023
@github-actions github-actions bot added this to the v4.65.0 milestone Apr 25, 2023
@georgealton georgealton deleted the f-aws_config_organization_custom_policy_rule branch April 25, 2023 21:03
@github-actions
Copy link

This functionality has been released in v4.65.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. Thank you!

@valscion
Copy link

Looks like the changelog accidentally referred to PR #21373 rather than this PR :)

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. generators Relates to code generators. new-resource Introduces a new resource. service/configservice Issues and PRs that pertain to the configservice service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
6 participants