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_backup_plan: Adding Copy Action support #11923

Merged
merged 3 commits into from
Apr 15, 2020

Conversation

slapula
Copy link
Contributor

@slapula slapula commented Feb 6, 2020

Community Note

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

Closes #11589

Release note for CHANGELOG:

r/aws_backup_plan: adding copy action support

Output from acceptance testing:

 make testacc TEST=./aws TESTARGS='-run=TestAccAwsBackupPlan_withCopyActions'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsBackupPlan_withCopyActions -timeout 120m
=== RUN   TestAccAwsBackupPlan_withCopyActions
=== PAUSE TestAccAwsBackupPlan_withCopyActions
=== RUN   TestAccAwsBackupPlan_withCopyActionsCrossRegion
=== PAUSE TestAccAwsBackupPlan_withCopyActionsCrossRegion
=== CONT  TestAccAwsBackupPlan_withCopyActions
=== CONT  TestAccAwsBackupPlan_withCopyActionsCrossRegion
--- PASS: TestAccAwsBackupPlan_withCopyActionsCrossRegion (24.55s)
--- PASS: TestAccAwsBackupPlan_withCopyActions (49.66s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	49.722s

@slapula slapula requested a review from a team February 6, 2020 03:58
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/XL Managed by automation to categorize the size of a PR. service/backup Issues and PRs that pertain to the backup service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. labels Feb 6, 2020
@giuliocalzolari
Copy link

would be great to have this code merged into master, any ETA?

@infa-sgowtham
Copy link

Any ETA when it will be live?

Copy link
Contributor

@bflad bflad left a 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,
Copy link
Contributor

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": {
Copy link
Contributor

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,

Comment on lines +329 to +330
for _, action := range rule.CopyActions {
mRule["copy_action"] = []interface{}{
Copy link
Contributor

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 {
Copy link
Contributor

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 {
Copy link
Contributor

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)
Copy link
Contributor

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. 😄

Suggested change
* `copy_action` - (Optional)
* `copy_action` - (Optional) Configuration block(s) with copy operation settings. Detailed below.

@bflad bflad 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 Mar 16, 2020
@bflad bflad self-assigned this Mar 16, 2020
@infa-sgowtham
Copy link

@slapula When can I expect this to be live?

@ldm810
Copy link

ldm810 commented Mar 26, 2020

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!
Thanks again!

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Apr 1, 2020
@bflad bflad added this to the v2.58.0 milestone Apr 15, 2020
Copy link
Contributor

@bflad bflad left a 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)

bflad added a commit that referenced this pull request Apr 15, 2020
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)
```
@bflad bflad merged commit 6262e3e into hashicorp:master Apr 15, 2020
bflad added a commit that referenced this pull request Apr 15, 2020
@ldm810
Copy link

ldm810 commented Apr 16, 2020

Thank you for merging!

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Apr 16, 2020
@ghost
Copy link

ghost commented Apr 17, 2020

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!

@ghost
Copy link

ghost commented May 15, 2020

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!

@ghost ghost locked and limited conversation to collaborators May 15, 2020
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/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.

AWS Backup: Cross Region Copy
5 participants