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

F config recording strategy #32066

Merged
merged 10 commits into from
Jun 21, 2023
Merged

Conversation

lafod
Copy link
Contributor

@lafod lafod commented Jun 16, 2023

Description

AWS config now support recording exclusion of resource type by specifying a recording strategy for the configuration recorder. this enhancement would make it possible to specify recording strategy of types defined below

ALL_SUPPORTED_RESOURCE_TYPES, AWS Config records configuration changes for all supported regional resource types.
INCLUSION_BY_RESOURCE_TYPES, AWS Config records configuration changes for only the resource types you specify in the resourceTypes
EXCLUSION_BY_RESOURCE_TYPES, AWS Config records configuration changes for all supported resource types except the resource types that you specify as exemptions to exclude from being recorded in the resourceTypes

Relations

Closes #32007

References

https://aws.amazon.com/about-aws/whats-new/2023/06/aws-config-recording-exclusions-resource-type/
https://docs.aws.amazon.com/config/latest/APIReference/API_PutConfigurationRecorder.html

Output from Acceptance Testing

make testacc TESTS=TestAccConfigService_serial PKG=configservice ACCTEST_PARALLELISM=5
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/configservice/... -v -count 1 -parallel 5 -run='TestAccConfigService_serial'  -timeout 180m
=== RUN   TestAccConfigService_serial
=== PAUSE TestAccConfigService_serial
=== CONT  TestAccConfigService_serial
=== RUN   TestAccConfigService_serial/OrganizationConformancePack
=== RUN   TestAccConfigService_serial/OrganizationConformancePack/forceNew
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationConformancePack/inputParameters
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationConformancePack/updateS3Delivery
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationConformancePack/updateS3Template
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationConformancePack/updateTemplateBody
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationConformancePack/basic
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationConformancePack/excludedAccounts
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationConformancePack/S3Template
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationConformancePack/updateInputParameters
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationConformancePack/disappears
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationConformancePack/S3Delivery
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/ConformancePack
=== RUN   TestAccConfigService_serial/ConformancePack/disappears
=== RUN   TestAccConfigService_serial/ConformancePack/forceNew
=== RUN   TestAccConfigService_serial/ConformancePack/S3Delivery
=== RUN   TestAccConfigService_serial/ConformancePack/S3TemplateAndTemplateBody
=== RUN   TestAccConfigService_serial/ConformancePack/updateS3Delivery
=== RUN   TestAccConfigService_serial/ConformancePack/updateS3Template
=== RUN   TestAccConfigService_serial/ConformancePack/basic
=== RUN   TestAccConfigService_serial/ConformancePack/inputParameters
=== RUN   TestAccConfigService_serial/ConformancePack/S3Template
=== RUN   TestAccConfigService_serial/ConformancePack/updateInputParameters
=== RUN   TestAccConfigService_serial/ConformancePack/updateTemplateBody
=== RUN   TestAccConfigService_serial/ConfigurationRecorderStatus
=== RUN   TestAccConfigService_serial/ConfigurationRecorderStatus/basic
=== RUN   TestAccConfigService_serial/ConfigurationRecorderStatus/startEnabled
=== RUN   TestAccConfigService_serial/ConfigurationRecorderStatus/importBasic
=== RUN   TestAccConfigService_serial/ConfigurationRecorder
=== RUN   TestAccConfigService_serial/ConfigurationRecorder/recordStrategy
=== RUN   TestAccConfigService_serial/ConfigurationRecorder/importBasic
=== RUN   TestAccConfigService_serial/ConfigurationRecorder/basic
=== RUN   TestAccConfigService_serial/ConfigurationRecorder/allParams
=== RUN   TestAccConfigService_serial/DeliveryChannel
=== RUN   TestAccConfigService_serial/DeliveryChannel/basic
=== RUN   TestAccConfigService_serial/DeliveryChannel/allParams
=== RUN   TestAccConfigService_serial/DeliveryChannel/importBasic
=== RUN   TestAccConfigService_serial/OrganizationCustomRule
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/ResourceIdScope
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/ExcludedAccounts
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/InputParameters
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/MaximumExecutionFrequency
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/Description
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/LambdaFunctionArn
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/ResourceTypesScope
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/TagKeyScope
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/TagValueScope
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/basic
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/disappears
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/errorHandling
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationCustomRule/TriggerTypes
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationManagedRule
=== RUN   TestAccConfigService_serial/OrganizationManagedRule/ExcludedAccounts
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationManagedRule/ResourceIdScope
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationManagedRule/ResourceTypesScope
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationManagedRule/RuleIdentifier
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationManagedRule/TagKeyScope
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationManagedRule/MaximumExecutionFrequency
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationManagedRule/TagValueScope
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationManagedRule/basic
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationManagedRule/disappears
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationManagedRule/errorHandling
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationManagedRule/Description
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/OrganizationManagedRule/InputParameters
    acctest.go:897: skipping tests; this AWS account must not be an existing member of an AWS Organization
=== RUN   TestAccConfigService_serial/RemediationConfiguration
=== RUN   TestAccConfigService_serial/RemediationConfiguration/basicBackward
=== RUN   TestAccConfigService_serial/RemediationConfiguration/disappears
=== RUN   TestAccConfigService_serial/RemediationConfiguration/migrateParameters
=== RUN   TestAccConfigService_serial/RemediationConfiguration/recreates
=== RUN   TestAccConfigService_serial/RemediationConfiguration/updates
=== RUN   TestAccConfigService_serial/RemediationConfiguration/values
=== RUN   TestAccConfigService_serial/RemediationConfiguration/basic
=== RUN   TestAccConfigService_serial/Config
=== RUN   TestAccConfigService_serial/Config/basic
=== RUN   TestAccConfigService_serial/Config/customlambda
=== RUN   TestAccConfigService_serial/Config/scopeTagKey
=== RUN   TestAccConfigService_serial/Config/scopeTagKeyEmpty
=== RUN   TestAccConfigService_serial/Config/scopeTagValue
=== RUN   TestAccConfigService_serial/Config/tags
=== RUN   TestAccConfigService_serial/Config/ownerAws
=== RUN   TestAccConfigService_serial/Config/customPolicy
=== RUN   TestAccConfigService_serial/Config/disappears
--- PASS: TestAccConfigService_serial (3822.81s)
    --- PASS: TestAccConfigService_serial/OrganizationConformancePack (11.75s)
        --- SKIP: TestAccConfigService_serial/OrganizationConformancePack/forceNew (2.11s)
        --- SKIP: TestAccConfigService_serial/OrganizationConformancePack/inputParameters (0.16s)
        --- SKIP: TestAccConfigService_serial/OrganizationConformancePack/updateS3Delivery (1.33s)
        --- SKIP: TestAccConfigService_serial/OrganizationConformancePack/updateS3Template (1.20s)
        --- SKIP: TestAccConfigService_serial/OrganizationConformancePack/updateTemplateBody (1.56s)
        --- SKIP: TestAccConfigService_serial/OrganizationConformancePack/basic (1.42s)
        --- SKIP: TestAccConfigService_serial/OrganizationConformancePack/excludedAccounts (0.15s)
        --- SKIP: TestAccConfigService_serial/OrganizationConformancePack/S3Template (1.18s)
        --- SKIP: TestAccConfigService_serial/OrganizationConformancePack/updateInputParameters (1.21s)
        --- SKIP: TestAccConfigService_serial/OrganizationConformancePack/disappears (1.26s)
        --- SKIP: TestAccConfigService_serial/OrganizationConformancePack/S3Delivery (0.15s)
    --- PASS: TestAccConfigService_serial/ConformancePack (1794.25s)
        --- PASS: TestAccConfigService_serial/ConformancePack/disappears (123.88s)
        --- PASS: TestAccConfigService_serial/ConformancePack/forceNew (243.84s)
        --- PASS: TestAccConfigService_serial/ConformancePack/S3Delivery (127.62s)
        --- PASS: TestAccConfigService_serial/ConformancePack/S3TemplateAndTemplateBody (127.05s)
        --- PASS: TestAccConfigService_serial/ConformancePack/updateS3Delivery (172.77s)
        --- PASS: TestAccConfigService_serial/ConformancePack/updateS3Template (173.03s)
        --- PASS: TestAccConfigService_serial/ConformancePack/basic (125.09s)
        --- PASS: TestAccConfigService_serial/ConformancePack/inputParameters (125.18s)
        --- PASS: TestAccConfigService_serial/ConformancePack/S3Template (127.44s)
        --- PASS: TestAccConfigService_serial/ConformancePack/updateInputParameters (205.80s)
        --- PASS: TestAccConfigService_serial/ConformancePack/updateTemplateBody (242.56s)
    --- PASS: TestAccConfigService_serial/ConfigurationRecorderStatus (144.30s)
        --- PASS: TestAccConfigService_serial/ConfigurationRecorderStatus/basic (35.03s)
        --- PASS: TestAccConfigService_serial/ConfigurationRecorderStatus/startEnabled (70.50s)
        --- PASS: TestAccConfigService_serial/ConfigurationRecorderStatus/importBasic (38.76s)
    --- PASS: TestAccConfigService_serial/ConfigurationRecorder (144.56s)
        --- PASS: TestAccConfigService_serial/ConfigurationRecorder/recordStrategy (34.47s)
        --- PASS: TestAccConfigService_serial/ConfigurationRecorder/importBasic (34.96s)
        --- PASS: TestAccConfigService_serial/ConfigurationRecorder/basic (33.50s)
        --- PASS: TestAccConfigService_serial/ConfigurationRecorder/allParams (41.63s)
    --- PASS: TestAccConfigService_serial/DeliveryChannel (107.55s)
        --- PASS: TestAccConfigService_serial/DeliveryChannel/basic (33.15s)
        --- PASS: TestAccConfigService_serial/DeliveryChannel/allParams (37.95s)
        --- PASS: TestAccConfigService_serial/DeliveryChannel/importBasic (36.45s)
    --- PASS: TestAccConfigService_serial/OrganizationCustomRule (12.10s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/ResourceIdScope (0.55s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/ExcludedAccounts (0.15s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/InputParameters (1.45s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/MaximumExecutionFrequency (1.34s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/Description (1.35s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/LambdaFunctionArn (0.22s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/ResourceTypesScope (1.68s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/TagKeyScope (0.15s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/TagValueScope (1.29s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/basic (1.37s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/disappears (0.15s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/errorHandling (1.24s)
        --- SKIP: TestAccConfigService_serial/OrganizationCustomRule/TriggerTypes (1.17s)
    --- PASS: TestAccConfigService_serial/OrganizationManagedRule (11.89s)
        --- SKIP: TestAccConfigService_serial/OrganizationManagedRule/ExcludedAccounts (1.26s)
        --- SKIP: TestAccConfigService_serial/OrganizationManagedRule/ResourceIdScope (1.21s)
        --- SKIP: TestAccConfigService_serial/OrganizationManagedRule/ResourceTypesScope (0.22s)
        --- SKIP: TestAccConfigService_serial/OrganizationManagedRule/RuleIdentifier (1.36s)
        --- SKIP: TestAccConfigService_serial/OrganizationManagedRule/TagKeyScope (1.17s)
        --- SKIP: TestAccConfigService_serial/OrganizationManagedRule/MaximumExecutionFrequency (1.23s)
        --- SKIP: TestAccConfigService_serial/OrganizationManagedRule/TagValueScope (0.15s)
        --- SKIP: TestAccConfigService_serial/OrganizationManagedRule/basic (1.10s)
        --- SKIP: TestAccConfigService_serial/OrganizationManagedRule/disappears (1.16s)
        --- SKIP: TestAccConfigService_serial/OrganizationManagedRule/errorHandling (1.51s)
        --- SKIP: TestAccConfigService_serial/OrganizationManagedRule/Description (1.32s)
        --- SKIP: TestAccConfigService_serial/OrganizationManagedRule/InputParameters (0.18s)
    --- PASS: TestAccConfigService_serial/RemediationConfiguration (702.81s)
        --- PASS: TestAccConfigService_serial/RemediationConfiguration/basicBackward (91.92s)
        --- PASS: TestAccConfigService_serial/RemediationConfiguration/disappears (88.31s)
        --- PASS: TestAccConfigService_serial/RemediationConfiguration/migrateParameters (126.90s)
        --- PASS: TestAccConfigService_serial/RemediationConfiguration/recreates (107.00s)
        --- PASS: TestAccConfigService_serial/RemediationConfiguration/updates (105.55s)
        --- PASS: TestAccConfigService_serial/RemediationConfiguration/values (92.22s)
        --- PASS: TestAccConfigService_serial/RemediationConfiguration/basic (90.91s)
    --- PASS: TestAccConfigService_serial/Config (893.61s)
        --- PASS: TestAccConfigService_serial/Config/basic (87.67s)
        --- PASS: TestAccConfigService_serial/Config/customlambda (126.68s)
        --- PASS: TestAccConfigService_serial/Config/scopeTagKey (103.69s)
        --- PASS: TestAccConfigService_serial/Config/scopeTagKeyEmpty (86.85s)
        --- PASS: TestAccConfigService_serial/Config/scopeTagValue (102.15s)
        --- PASS: TestAccConfigService_serial/Config/tags (121.21s)
        --- PASS: TestAccConfigService_serial/Config/ownerAws (89.48s)
        --- PASS: TestAccConfigService_serial/Config/customPolicy (89.97s)
        --- PASS: TestAccConfigService_serial/Config/disappears (85.90s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/configservice  3826.596s

...

@github-actions
Copy link

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 documentation Introduces or discusses updates to documentation. 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. needs-triage Waiting for first response or review from a maintainer. partner Contribution from a partner. labels Jun 16, 2023
@justinretzolk justinretzolk added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Jun 16, 2023
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 🚀.

% make testacc TESTARGS='-run=TestAccConfigService_serial/ConfigurationRecorder$$' PKG=configservice
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/configservice/... -v -count 1 -parallel 20  -run=TestAccConfigService_serial/ConfigurationRecorder$ -timeout 180m
=== RUN   TestAccConfigService_serial
=== PAUSE TestAccConfigService_serial
=== CONT  TestAccConfigService_serial
=== RUN   TestAccConfigService_serial/ConfigurationRecorder
=== RUN   TestAccConfigService_serial/ConfigurationRecorder/basic
=== RUN   TestAccConfigService_serial/ConfigurationRecorder/allParams
=== RUN   TestAccConfigService_serial/ConfigurationRecorder/recordStrategy
=== RUN   TestAccConfigService_serial/ConfigurationRecorder/disappears
--- PASS: TestAccConfigService_serial (143.16s)
    --- PASS: TestAccConfigService_serial/ConfigurationRecorder (143.16s)
        --- PASS: TestAccConfigService_serial/ConfigurationRecorder/basic (38.71s)
        --- PASS: TestAccConfigService_serial/ConfigurationRecorder/allParams (34.71s)
        --- PASS: TestAccConfigService_serial/ConfigurationRecorder/recordStrategy (33.98s)
        --- PASS: TestAccConfigService_serial/ConfigurationRecorder/disappears (35.75s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/configservice	148.912s

@ewbankkit
Copy link
Contributor

@lafod Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit bbd8238 into hashicorp:main Jun 21, 2023
@github-actions github-actions bot added this to the v5.5.0 milestone Jun 21, 2023
@github-actions
Copy link

This functionality has been released in v5.5.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!

@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 Jul 23, 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. enhancement Requests to existing resources that expand the functionality or scope. partner Contribution from a partner. 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
Development

Successfully merging this pull request may close these issues.

[Enhancement]: Add support to AWS config to configuration recorder to support recording strategy
3 participants