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 timezone argument to aws_backup_plan #33653

Merged
merged 15 commits into from
Oct 7, 2024

Conversation

autotune
Copy link
Contributor

Description

The aws_backup_plan lets you set the cron schedule in the rule block, but does not allow you to set which timezone the cron schedule should be evaluated in, which means that it defaults to UTC. The AWS console and the AWS CLI both support setting the timezone.

Expected Terraform Configuration

resource "aws_backup_plan" "example" {
  name = "tf_example_backup_plan"

  rule {
    rule_name         = "tf_example_backup_rule"
    target_vault_name = aws_backup_vault.test.name
    schedule          = "cron(0 12 * * ? *)"
    schedule_timezone = "Pacific/Fiji"

    lifecycle {
      delete_after = 14
    }
  }

  advanced_backup_setting {
    backup_options = {
      WindowsVSS = "enabled"
    }
    resource_type = "EC2"
  }
}

Relations

Closes #33605

References

ScheduleExpressionTimezone

Output from Acceptance Testing

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/backup/... -v -count 1 -parallel 20 -run='TestAccBackupPlan_basic'  -timeout 360m
=== RUN   TestAccBackupPlan_basic
=== PAUSE TestAccBackupPlan_basic
=== CONT  TestAccBackupPlan_basic
--- PASS: TestAccBackupPlan_basic (20.82s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/backup	22.898s```

@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 size/S Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/backup Issues and PRs that pertain to the backup service. labels Sep 27, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 27, 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 Oct 26, 2023
@ewbankkit ewbankkit self-assigned this Oct 4, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 4, 2024
@ewbankkit ewbankkit requested a review from a team as a code owner October 7, 2024 19:48
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=TestAccBackupPlan_' PKG=backup ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.1 test ./internal/service/backup/... -v -count 1 -parallel 3  -run=TestAccBackupPlan_ -timeout 360m
=== RUN   TestAccBackupPlan_basic
=== PAUSE TestAccBackupPlan_basic
=== RUN   TestAccBackupPlan_disappears
=== PAUSE TestAccBackupPlan_disappears
=== RUN   TestAccBackupPlan_tags
=== PAUSE TestAccBackupPlan_tags
=== RUN   TestAccBackupPlan_withRules
=== PAUSE TestAccBackupPlan_withRules
=== RUN   TestAccBackupPlan_withLifecycle
=== PAUSE TestAccBackupPlan_withLifecycle
=== RUN   TestAccBackupPlan_withRecoveryPointTags
=== PAUSE TestAccBackupPlan_withRecoveryPointTags
=== RUN   TestAccBackupPlan_RuleCopyAction_sameRegion
=== PAUSE TestAccBackupPlan_RuleCopyAction_sameRegion
=== RUN   TestAccBackupPlan_RuleCopyAction_noLifecycle
=== PAUSE TestAccBackupPlan_RuleCopyAction_noLifecycle
=== RUN   TestAccBackupPlan_RuleCopyAction_multiple
=== PAUSE TestAccBackupPlan_RuleCopyAction_multiple
=== RUN   TestAccBackupPlan_RuleCopyAction_crossRegion
=== PAUSE TestAccBackupPlan_RuleCopyAction_crossRegion
=== RUN   TestAccBackupPlan_advancedBackupSetting
=== PAUSE TestAccBackupPlan_advancedBackupSetting
=== RUN   TestAccBackupPlan_enableContinuousBackup
=== PAUSE TestAccBackupPlan_enableContinuousBackup
=== RUN   TestAccBackupPlan_upgradeScheduleExpressionTimezone
=== PAUSE TestAccBackupPlan_upgradeScheduleExpressionTimezone
=== RUN   TestAccBackupPlan_scheduleExpressionTimezone
=== PAUSE TestAccBackupPlan_scheduleExpressionTimezone
=== CONT  TestAccBackupPlan_basic
=== CONT  TestAccBackupPlan_RuleCopyAction_noLifecycle
=== CONT  TestAccBackupPlan_enableContinuousBackup
--- PASS: TestAccBackupPlan_basic (14.77s)
=== CONT  TestAccBackupPlan_scheduleExpressionTimezone
--- PASS: TestAccBackupPlan_enableContinuousBackup (14.77s)
=== CONT  TestAccBackupPlan_upgradeScheduleExpressionTimezone
--- PASS: TestAccBackupPlan_RuleCopyAction_noLifecycle (33.78s)
=== CONT  TestAccBackupPlan_tags
--- PASS: TestAccBackupPlan_scheduleExpressionTimezone (24.19s)
=== CONT  TestAccBackupPlan_withRules
=== CONT  TestAccBackupPlan_RuleCopyAction_crossRegion
--- PASS: TestAccBackupPlan_upgradeScheduleExpressionTimezone (42.54s)
--- PASS: TestAccBackupPlan_tags (32.59s)
=== CONT  TestAccBackupPlan_advancedBackupSetting
--- PASS: TestAccBackupPlan_withRules (30.36s)
=== CONT  TestAccBackupPlan_RuleCopyAction_sameRegion
--- PASS: TestAccBackupPlan_RuleCopyAction_crossRegion (20.61s)
=== CONT  TestAccBackupPlan_RuleCopyAction_multiple
--- PASS: TestAccBackupPlan_advancedBackupSetting (21.65s)
=== CONT  TestAccBackupPlan_withRecoveryPointTags
--- PASS: TestAccBackupPlan_RuleCopyAction_multiple (13.72s)
=== CONT  TestAccBackupPlan_disappears
--- PASS: TestAccBackupPlan_RuleCopyAction_sameRegion (30.38s)
=== CONT  TestAccBackupPlan_withLifecycle
--- PASS: TestAccBackupPlan_disappears (11.44s)
--- PASS: TestAccBackupPlan_withRecoveryPointTags (29.84s)
--- PASS: TestAccBackupPlan_withLifecycle (46.04s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/backup	151.194s
% make testacc TESTARGS='-run=TestAccBackupPlanDataSource_' PKG=backup ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.1 test ./internal/service/backup/... -v -count 1 -parallel 3  -run=TestAccBackupPlanDataSource_ -timeout 360m
=== RUN   TestAccBackupPlanDataSource_basic
=== PAUSE TestAccBackupPlanDataSource_basic
=== CONT  TestAccBackupPlanDataSource_basic
--- PASS: TestAccBackupPlanDataSource_basic (12.24s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/backup	17.578s

@ewbankkit
Copy link
Contributor

@autotune Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 2894297 into hashicorp:main Oct 7, 2024
40 checks passed
@github-actions github-actions bot added this to the v5.71.0 milestone Oct 7, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 15, 2024
Copy link

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

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 Nov 15, 2024
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. service/backup Issues and PRs that pertain to the backup service. size/S 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]: Support setting schedule timezone in aws_backup_plan
3 participants