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

add new attributes to secrets manager rotation rules #30425

Merged
merged 10 commits into from
Apr 4, 2023

Conversation

silvaalbert
Copy link
Contributor

Description

This adds duration and schedule_expression attributes to the rotation_rules block.

Relations

Closes #28016

References

https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_RotationRulesType.html

Output from Acceptance Testing

SecretRotation resource
make testacc TESTS=TestAccSecretsManagerSecretRotation PKG=secretsmanager ACCTEST_PARALLELISM=5                                     
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/secretsmanager/... -v -count 1 -parallel 5 -run='TestAccSecretsManagerSecretRotation'  -timeout 180m
=== RUN   TestAccSecretsManagerSecretRotationDataSource_basic
=== PAUSE TestAccSecretsManagerSecretRotationDataSource_basic
=== RUN   TestAccSecretsManagerSecretRotation_basic
=== PAUSE TestAccSecretsManagerSecretRotation_basic
=== RUN   TestAccSecretsManagerSecretRotation_scheduleExpression
=== PAUSE TestAccSecretsManagerSecretRotation_scheduleExpression
=== RUN   TestAccSecretsManagerSecretRotation_duration
=== PAUSE TestAccSecretsManagerSecretRotation_duration
=== CONT  TestAccSecretsManagerSecretRotationDataSource_basic
=== CONT  TestAccSecretsManagerSecretRotation_scheduleExpression
=== CONT  TestAccSecretsManagerSecretRotation_duration
=== CONT  TestAccSecretsManagerSecretRotation_basic
--- PASS: TestAccSecretsManagerSecretRotation_basic (34.19s)
--- PASS: TestAccSecretsManagerSecretRotation_scheduleExpression (51.49s)
--- PASS: TestAccSecretsManagerSecretRotation_duration (55.34s)
--- PASS: TestAccSecretsManagerSecretRotationDataSource_basic (59.88s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/secretsmanager	63.074s
Secret resource
make testacc TESTS=TestAccSecretsManagerSecret PKG=secretsmanager ACCTEST_PARALLELISM=5                                 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/secretsmanager/... -v -count 1 -parallel 5 -run='TestAccSecretsManagerSecret'  -timeout 180m
=== RUN   TestAccSecretsManagerSecretDataSource_basic
=== PAUSE TestAccSecretsManagerSecretDataSource_basic
=== RUN   TestAccSecretsManagerSecretDataSource_arn
=== PAUSE TestAccSecretsManagerSecretDataSource_arn
=== RUN   TestAccSecretsManagerSecretDataSource_name
=== PAUSE TestAccSecretsManagerSecretDataSource_name
=== RUN   TestAccSecretsManagerSecretDataSource_policy
=== PAUSE TestAccSecretsManagerSecretDataSource_policy
=== RUN   TestAccSecretsManagerSecretPolicy_basic
=== PAUSE TestAccSecretsManagerSecretPolicy_basic
=== RUN   TestAccSecretsManagerSecretPolicy_blockPublicPolicy
=== PAUSE TestAccSecretsManagerSecretPolicy_blockPublicPolicy
=== RUN   TestAccSecretsManagerSecretPolicy_disappears
=== PAUSE TestAccSecretsManagerSecretPolicy_disappears
=== RUN   TestAccSecretsManagerSecretRotationDataSource_basic
=== PAUSE TestAccSecretsManagerSecretRotationDataSource_basic
=== RUN   TestAccSecretsManagerSecretRotation_basic
=== PAUSE TestAccSecretsManagerSecretRotation_basic
=== RUN   TestAccSecretsManagerSecretRotation_scheduleExpression
=== PAUSE TestAccSecretsManagerSecretRotation_scheduleExpression
=== RUN   TestAccSecretsManagerSecretRotation_duration
=== PAUSE TestAccSecretsManagerSecretRotation_duration
=== RUN   TestAccSecretsManagerSecret_basic
=== PAUSE TestAccSecretsManagerSecret_basic
=== RUN   TestAccSecretsManagerSecret_withNamePrefix
=== PAUSE TestAccSecretsManagerSecret_withNamePrefix
=== RUN   TestAccSecretsManagerSecret_description
=== PAUSE TestAccSecretsManagerSecret_description
=== RUN   TestAccSecretsManagerSecret_basicReplica
=== PAUSE TestAccSecretsManagerSecret_basicReplica
=== RUN   TestAccSecretsManagerSecret_overwriteReplica
=== PAUSE TestAccSecretsManagerSecret_overwriteReplica
=== RUN   TestAccSecretsManagerSecret_kmsKeyID
=== PAUSE TestAccSecretsManagerSecret_kmsKeyID
=== RUN   TestAccSecretsManagerSecret_RecoveryWindowInDays_recreate
=== PAUSE TestAccSecretsManagerSecret_RecoveryWindowInDays_recreate
=== RUN   TestAccSecretsManagerSecret_rotationLambdaARN
=== PAUSE TestAccSecretsManagerSecret_rotationLambdaARN
=== RUN   TestAccSecretsManagerSecret_rotationRules
=== PAUSE TestAccSecretsManagerSecret_rotationRules
=== RUN   TestAccSecretsManagerSecret_tags
=== PAUSE TestAccSecretsManagerSecret_tags
=== RUN   TestAccSecretsManagerSecret_policy
=== PAUSE TestAccSecretsManagerSecret_policy
=== RUN   TestAccSecretsManagerSecretVersionDataSource_basic
=== PAUSE TestAccSecretsManagerSecretVersionDataSource_basic
=== RUN   TestAccSecretsManagerSecretVersionDataSource_versionID
=== PAUSE TestAccSecretsManagerSecretVersionDataSource_versionID
=== RUN   TestAccSecretsManagerSecretVersionDataSource_versionStage
=== PAUSE TestAccSecretsManagerSecretVersionDataSource_versionStage
=== RUN   TestAccSecretsManagerSecretVersion_basicString
=== PAUSE TestAccSecretsManagerSecretVersion_basicString
=== RUN   TestAccSecretsManagerSecretVersion_base64Binary
=== PAUSE TestAccSecretsManagerSecretVersion_base64Binary
=== RUN   TestAccSecretsManagerSecretVersion_versionStages
=== PAUSE TestAccSecretsManagerSecretVersion_versionStages
=== RUN   TestAccSecretsManagerSecretsDataSource_filter
=== PAUSE TestAccSecretsManagerSecretsDataSource_filter
=== CONT  TestAccSecretsManagerSecretDataSource_basic
=== CONT  TestAccSecretsManagerSecret_overwriteReplica
=== CONT  TestAccSecretsManagerSecretVersionDataSource_basic
=== CONT  TestAccSecretsManagerSecret_rotationRules
=== CONT  TestAccSecretsManagerSecret_policy
=== NAME  TestAccSecretsManagerSecret_overwriteReplica
    acctest.go:806: AWS_ALTERNATE_REGION and AWS_THIRD_REGION must be set to different values for acceptance tests
--- FAIL: TestAccSecretsManagerSecret_overwriteReplica (0.84s)
=== CONT  TestAccSecretsManagerSecret_tags
--- PASS: TestAccSecretsManagerSecretDataSource_basic (3.60s)
=== CONT  TestAccSecretsManagerSecretRotation_basic
--- PASS: TestAccSecretsManagerSecretVersionDataSource_basic (9.28s)
=== CONT  TestAccSecretsManagerSecretVersion_base64Binary
--- PASS: TestAccSecretsManagerSecretVersion_base64Binary (8.14s)
=== CONT  TestAccSecretsManagerSecret_basicReplica
--- PASS: TestAccSecretsManagerSecret_tags (25.63s)
=== CONT  TestAccSecretsManagerSecretsDataSource_filter
--- PASS: TestAccSecretsManagerSecret_basicReplica (13.28s)
=== CONT  TestAccSecretsManagerSecret_description
--- PASS: TestAccSecretsManagerSecret_rotationRules (33.26s)
=== CONT  TestAccSecretsManagerSecretVersion_versionStages
--- PASS: TestAccSecretsManagerSecretRotation_basic (33.70s)
=== CONT  TestAccSecretsManagerSecret_withNamePrefix
--- PASS: TestAccSecretsManagerSecret_policy (37.57s)
=== CONT  TestAccSecretsManagerSecret_basic
--- PASS: TestAccSecretsManagerSecret_description (15.11s)
=== CONT  TestAccSecretsManagerSecretPolicy_basic
--- PASS: TestAccSecretsManagerSecret_withNamePrefix (8.98s)
=== CONT  TestAccSecretsManagerSecretRotation_duration
--- PASS: TestAccSecretsManagerSecret_basic (9.07s)
=== CONT  TestAccSecretsManagerSecretRotation_scheduleExpression
--- PASS: TestAccSecretsManagerSecretVersion_versionStages (20.66s)
=== CONT  TestAccSecretsManagerSecret_RecoveryWindowInDays_recreate
--- PASS: TestAccSecretsManagerSecretPolicy_basic (22.31s)
=== CONT  TestAccSecretsManagerSecret_rotationLambdaARN
--- PASS: TestAccSecretsManagerSecretsDataSource_filter (42.27s)
=== CONT  TestAccSecretsManagerSecret_kmsKeyID
--- PASS: TestAccSecretsManagerSecret_RecoveryWindowInDays_recreate (15.60s)
=== CONT  TestAccSecretsManagerSecretVersion_basicString
--- PASS: TestAccSecretsManagerSecretVersion_basicString (8.45s)
=== CONT  TestAccSecretsManagerSecretVersionDataSource_versionID
--- PASS: TestAccSecretsManagerSecret_kmsKeyID (15.31s)
=== CONT  TestAccSecretsManagerSecretPolicy_disappears
--- PASS: TestAccSecretsManagerSecretRotation_duration (38.17s)
=== CONT  TestAccSecretsManagerSecretDataSource_name
--- PASS: TestAccSecretsManagerSecretVersionDataSource_versionID (7.47s)
=== CONT  TestAccSecretsManagerSecretPolicy_blockPublicPolicy
--- PASS: TestAccSecretsManagerSecretDataSource_name (6.98s)
=== CONT  TestAccSecretsManagerSecretDataSource_policy
=== NAME  TestAccSecretsManagerSecretPolicy_blockPublicPolicy
    secret_policy_test.go:66: Step 1/4 error: After applying this test step, the plan was not empty.
        stdout:


        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
          ~ update in-place

        Terraform will perform the following actions:

          # aws_secretsmanager_secret_policy.test will be updated in-place
          ~ resource "aws_secretsmanager_secret_policy" "test" {
                id                  = "arn:aws:secretsmanager:us-east-1:590846941288:secret:tf-acc-test-1621540161389076602-SSxhj2"
              ~ policy              = jsonencode(
                  ~ {
                      ~ Statement = [
                          ~ {
                              ~ Principal = {
                                  ~ AWS = "AROAYTEJY3BUO2NLZY6S6" -> "arn:aws:iam::590846941288:role/tf-acc-test-1621540161389076602"
                                }
                                # (4 unchanged attributes hidden)
                            },
                        ]
                        # (1 unchanged attribute hidden)
                    }
                )
                # (2 unchanged attributes hidden)
            }

        Plan: 0 to add, 1 to change, 0 to destroy.
--- PASS: TestAccSecretsManagerSecretDataSource_policy (6.86s)
=== CONT  TestAccSecretsManagerSecretDataSource_arn
--- FAIL: TestAccSecretsManagerSecretPolicy_blockPublicPolicy (14.30s)
=== CONT  TestAccSecretsManagerSecretVersionDataSource_versionStage
--- PASS: TestAccSecretsManagerSecretRotation_scheduleExpression (54.31s)
=== CONT  TestAccSecretsManagerSecretRotationDataSource_basic
--- PASS: TestAccSecretsManagerSecretDataSource_arn (7.66s)
--- PASS: TestAccSecretsManagerSecretVersionDataSource_versionStage (7.83s)
--- PASS: TestAccSecretsManagerSecretPolicy_disappears (23.64s)
--- PASS: TestAccSecretsManagerSecret_rotationLambdaARN (43.64s)
--- PASS: TestAccSecretsManagerSecretRotationDataSource_basic (31.92s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/secretsmanager	136.226s
FAIL
make: *** [testacc] Error 1

@github-actions
Copy link

github-actions bot commented Apr 3, 2023

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 size/L Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/secretsmanager Issues and PRs that pertain to the secretsmanager service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 3, 2023
@silvaalbert silvaalbert marked this pull request as ready for review April 4, 2023 11:05
@ewbankkit ewbankkit added the partner Contribution from a partner. label Apr 4, 2023
@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Apr 4, 2023
@ewbankkit ewbankkit self-assigned this Apr 4, 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=TestAccSecretsManagerSecretDataSource_\|TestAccSecretsManagerSecret_\|TestAccSecretsManagerSecretRotationDataSource_\|TestAccSecretsManagerSecretRotation_' PKG=secretsmanager ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/secretsmanager/... -v -count 1 -parallel 3  -run=TestAccSecretsManagerSecretDataSource_\|TestAccSecretsManagerSecret_\|TestAccSecretsManagerSecretRotationDataSource_\|TestAccSecretsManagerSecretRotation_ -timeout 180m
=== RUN   TestAccSecretsManagerSecretDataSource_basic
=== PAUSE TestAccSecretsManagerSecretDataSource_basic
=== RUN   TestAccSecretsManagerSecretDataSource_arn
=== PAUSE TestAccSecretsManagerSecretDataSource_arn
=== RUN   TestAccSecretsManagerSecretDataSource_name
=== PAUSE TestAccSecretsManagerSecretDataSource_name
=== RUN   TestAccSecretsManagerSecretDataSource_policy
=== PAUSE TestAccSecretsManagerSecretDataSource_policy
=== RUN   TestAccSecretsManagerSecretRotationDataSource_basic
=== PAUSE TestAccSecretsManagerSecretRotationDataSource_basic
=== RUN   TestAccSecretsManagerSecretRotation_basic
=== PAUSE TestAccSecretsManagerSecretRotation_basic
=== RUN   TestAccSecretsManagerSecretRotation_scheduleExpression
=== PAUSE TestAccSecretsManagerSecretRotation_scheduleExpression
=== RUN   TestAccSecretsManagerSecretRotation_duration
=== PAUSE TestAccSecretsManagerSecretRotation_duration
=== RUN   TestAccSecretsManagerSecret_basic
=== PAUSE TestAccSecretsManagerSecret_basic
=== RUN   TestAccSecretsManagerSecret_withNamePrefix
=== PAUSE TestAccSecretsManagerSecret_withNamePrefix
=== RUN   TestAccSecretsManagerSecret_description
=== PAUSE TestAccSecretsManagerSecret_description
=== RUN   TestAccSecretsManagerSecret_basicReplica
=== PAUSE TestAccSecretsManagerSecret_basicReplica
=== RUN   TestAccSecretsManagerSecret_overwriteReplica
=== PAUSE TestAccSecretsManagerSecret_overwriteReplica
=== RUN   TestAccSecretsManagerSecret_kmsKeyID
=== PAUSE TestAccSecretsManagerSecret_kmsKeyID
=== RUN   TestAccSecretsManagerSecret_RecoveryWindowInDays_recreate
=== PAUSE TestAccSecretsManagerSecret_RecoveryWindowInDays_recreate
=== RUN   TestAccSecretsManagerSecret_rotationLambdaARN
=== PAUSE TestAccSecretsManagerSecret_rotationLambdaARN
=== RUN   TestAccSecretsManagerSecret_rotationRules
=== PAUSE TestAccSecretsManagerSecret_rotationRules
=== RUN   TestAccSecretsManagerSecret_tags
=== PAUSE TestAccSecretsManagerSecret_tags
=== RUN   TestAccSecretsManagerSecret_policy
=== PAUSE TestAccSecretsManagerSecret_policy
=== CONT  TestAccSecretsManagerSecretDataSource_basic
=== CONT  TestAccSecretsManagerSecret_description
=== CONT  TestAccSecretsManagerSecret_policy
--- PASS: TestAccSecretsManagerSecretDataSource_basic (9.56s)
=== CONT  TestAccSecretsManagerSecret_tags
--- PASS: TestAccSecretsManagerSecret_description (42.37s)
=== CONT  TestAccSecretsManagerSecret_rotationRules
--- PASS: TestAccSecretsManagerSecret_policy (71.60s)
=== CONT  TestAccSecretsManagerSecret_rotationLambdaARN
--- PASS: TestAccSecretsManagerSecret_tags (71.00s)
=== CONT  TestAccSecretsManagerSecret_RecoveryWindowInDays_recreate
--- PASS: TestAccSecretsManagerSecret_rotationRules (61.43s)
=== CONT  TestAccSecretsManagerSecret_kmsKeyID
--- PASS: TestAccSecretsManagerSecret_RecoveryWindowInDays_recreate (40.39s)
=== CONT  TestAccSecretsManagerSecret_overwriteReplica
--- PASS: TestAccSecretsManagerSecret_rotationLambdaARN (66.28s)
=== CONT  TestAccSecretsManagerSecret_basicReplica
--- PASS: TestAccSecretsManagerSecret_kmsKeyID (42.36s)
=== CONT  TestAccSecretsManagerSecretRotation_basic
--- PASS: TestAccSecretsManagerSecret_basicReplica (29.90s)
=== CONT  TestAccSecretsManagerSecret_withNamePrefix
--- PASS: TestAccSecretsManagerSecret_withNamePrefix (22.90s)
=== CONT  TestAccSecretsManagerSecret_basic
--- PASS: TestAccSecretsManagerSecretRotation_basic (49.20s)
=== CONT  TestAccSecretsManagerSecretRotation_duration
--- PASS: TestAccSecretsManagerSecret_basic (22.33s)
=== CONT  TestAccSecretsManagerSecretRotation_scheduleExpression
--- PASS: TestAccSecretsManagerSecret_overwriteReplica (103.95s)
=== CONT  TestAccSecretsManagerSecretDataSource_policy
--- PASS: TestAccSecretsManagerSecretRotation_duration (46.84s)
=== CONT  TestAccSecretsManagerSecretRotationDataSource_basic
--- PASS: TestAccSecretsManagerSecretDataSource_policy (18.94s)
=== CONT  TestAccSecretsManagerSecretDataSource_name
--- PASS: TestAccSecretsManagerSecretDataSource_name (19.44s)
=== CONT  TestAccSecretsManagerSecretDataSource_arn
--- PASS: TestAccSecretsManagerSecretRotation_scheduleExpression (67.01s)
--- PASS: TestAccSecretsManagerSecretDataSource_arn (19.29s)
--- PASS: TestAccSecretsManagerSecretRotationDataSource_basic (48.68s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/secretsmanager	300.713s

@ewbankkit ewbankkit added the enhancement Requests to existing resources that expand the functionality or scope. label Apr 4, 2023
@ewbankkit
Copy link
Contributor

@silvaalbert Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 4671e8b into hashicorp:main Apr 4, 2023
@github-actions github-actions bot added this to the v4.62.0 milestone Apr 4, 2023
@github-actions
Copy link

github-actions bot commented Apr 7, 2023

This functionality has been released in v4.62.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

github-actions bot commented May 9, 2023

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 9, 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/secretsmanager Issues and PRs that pertain to the secretsmanager 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]: aws secret manager rotation rules - schedule expression
3 participants