-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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_backup_plan: Adding Copy Action support #11923
Conversation
would be great to have this code merged into master, any ETA? |
Any ETA when it will be live? |
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.
Hey @slapula 👋 This is looking pretty good. A few little things and this should be good to go. Please reach out if you have any questions or do not have time to implement the feedback. 👍
@@ -69,6 +69,35 @@ func resourceAwsBackupPlan() *schema.Resource { | |||
}, | |||
}, | |||
}, | |||
"copy_action": { | |||
Type: schema.TypeList, |
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.
If this attribute supports more than 1, we should add a covering acceptance test configuration to determine if the API orders results (or requires TypeSet
), otherwise, we should ensure this has MaxItems: 1
as well. 👍
}, | ||
}, | ||
}, | ||
"destination_vault_arn": { |
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.
Nit: We can add plan-time validation for this attribute via ValidateFunc: validateArn,
for _, action := range rule.CopyActions { | ||
mRule["copy_action"] = []interface{}{ |
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.
Should this be overwriting the results every loop?
@@ -625,3 +760,109 @@ resource "aws_backup_plan" "test" { | |||
} | |||
`, rName) | |||
} | |||
|
|||
func testAccAwsBackupPlanConfig_copyAction(rName1 string, rName2 string) string { |
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.
Nit: Can remove the second randomized name parameter by appending -2
or similar in the template below, e.g. name = "%[1]s-2"
`, rName1, rName2) | ||
} | ||
|
||
func testAccAwsBackupPlanConfig_copyActionUpdated(rName1 string, rName2 string) string { |
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.
Nit: Can remove this mostly duplicated configuration by parameterizing cold_storage_after
and delete_after
, e.g.
lifecycle {
cold_storage_after = %[3]d
delete_after = %[4]d
}
* `completion_window` - (Optional) The amount of time AWS Backup attempts a backup before canceling the job and returning an error. | ||
* `lifecycle` - (Optional) The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. Fields documented below. | ||
* `recovery_point_tags` - (Optional) Metadata that you can assign to help organize the resources that you create. | ||
* `copy_action` - (Optional) |
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.
Looks like this is missing. 😄
* `copy_action` - (Optional) | |
* `copy_action` - (Optional) Configuration block(s) with copy operation settings. Detailed below. |
@slapula When can I expect this to be live? |
Hey @slapula thanks for putting this PR together. Do you have an ETA on when you can address the changes? Looking forwarding to using this! |
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.
Hi again @slapula 👋 Since we didn't hear back from you, we addressed the review feedback in a followup commit. Thanks for starting this.
Output from acceptance testing:
--- PASS: TestAccAwsBackupPlan_disappears (18.44s)
--- PASS: TestAccAwsBackupPlan_basic (22.03s)
--- PASS: TestAccAwsBackupPlan_Rule_CopyAction_Multiple (22.15s)
--- PASS: TestAccAwsBackupPlan_Rule_CopyAction_CrossRegion (22.21s)
--- PASS: TestAccAwsBackupPlan_withRecoveryPointTags (46.63s)
--- PASS: TestAccAwsBackupPlan_withRules (46.98s)
--- PASS: TestAccAwsBackupPlan_withTags (47.99s)
--- PASS: TestAccAwsBackupPlan_Rule_CopyAction_SameRegion (48.55s)
--- PASS: TestAccAwsBackupPlan_withLifecycle (62.46s)
Reference: #11923 (review) Output from acceptance testing: ``` --- PASS: TestAccAwsBackupPlan_disappears (18.44s) --- PASS: TestAccAwsBackupPlan_basic (22.03s) --- PASS: TestAccAwsBackupPlan_Rule_CopyAction_Multiple (22.15s) --- PASS: TestAccAwsBackupPlan_Rule_CopyAction_CrossRegion (22.21s) --- PASS: TestAccAwsBackupPlan_withRecoveryPointTags (46.63s) --- PASS: TestAccAwsBackupPlan_withRules (46.98s) --- PASS: TestAccAwsBackupPlan_withTags (47.99s) --- PASS: TestAccAwsBackupPlan_Rule_CopyAction_SameRegion (48.55s) --- PASS: TestAccAwsBackupPlan_withLifecycle (62.46s) ```
Thank you for merging! |
This has been released in version 2.58.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! |
Community Note
Closes #11589
Release note for CHANGELOG:
Output from acceptance testing: