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: Add missing tags_all attribute #19143

Merged
merged 1 commit into from
Apr 28, 2021

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Apr 28, 2021

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

Relates: #18715.
Relates: #7926.

Before fix:

------- Stdout: -------
=== RUN   TestAccAWSBackupPlanDataSource_basic
=== PAUSE TestAccAWSBackupPlanDataSource_basic
=== CONT  TestAccAWSBackupPlanDataSource_basic
data_source_aws_backup_plan_test.go:18: Step 2/2 error: Error running pre-apply refresh: exit status 1
Error: error setting new tags_all diff: SetNew: invalid key: tags_all
on terraform_plugin_test.tf line 6, in resource "aws_backup_plan" "test":
6: resource "aws_backup_plan" "test" {
--- FAIL: TestAccAWSBackupPlanDataSource_basic (19.28s)
FAIL

------- Stdout: -------
=== RUN   TestAccAWSBackupSelectionDataSource_basic
=== PAUSE TestAccAWSBackupSelectionDataSource_basic
=== CONT  TestAccAWSBackupSelectionDataSource_basic
------- Stderr: -------
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 267 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.SetTagsDiff(0x8e39888, 0xc0036fbfc0, 0xc001683400, 0x706aee0, 0xc0028a0b00, 0x8e577f0, 0xc0009db480)
  /opt/teamcity-agent/work/2e10e023da0c7520/src/github.com/terraform-providers/terraform-provider-aws/aws/tags.go:123 +0x3a5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc00135f470, 0x8e39888, 0xc0036fbfc0, 0xc0016840e0, 0xc0033b6c30, 0x834c9f8, 0x706aee0, 0xc0028a0b00, 0xca42a00, 0x678d820, ...)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/schema.go:540 +0xb29
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0xc001375dc0, 0x8e39888, 0xc0036fbfc0, 0xc0016840e0, 0xc0033b6c30, 0x706aee0, 0xc0028a0b00, 0x0, 0x0, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/resource.go:506 +0xa5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0xc0037f71e8, 0x8e39888, 0xc0036fbfc0, 0xc002e44960, 0xc0036fbfc0, 0x7c0b1c0, 0xc003136d00)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/grpc_provider.go:693 +0x7c5
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).PlanResourceChange(0xc002b7c180, 0x8e39930, 0xc0036fbfc0, 0xc0009e3f80, 0xc002b7c180, 0xc003136d20, 0xc00038d

Output from acceptance testing:

Commercial
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSBackupPlanDataSource_basic\|TestAccAWSBackupSelectionDataSource_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSBackupPlanDataSource_basic\|TestAccAWSBackupSelectionDataSource_basic -timeout 180m
=== RUN   TestAccAWSBackupPlanDataSource_basic
=== PAUSE TestAccAWSBackupPlanDataSource_basic
=== RUN   TestAccAWSBackupSelectionDataSource_basic
=== PAUSE TestAccAWSBackupSelectionDataSource_basic
=== CONT  TestAccAWSBackupPlanDataSource_basic
=== CONT  TestAccAWSBackupSelectionDataSource_basic
--- PASS: TestAccAWSBackupPlanDataSource_basic (17.11s)
--- PASS: TestAccAWSBackupSelectionDataSource_basic (18.26s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	21.199s
GovCloud
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSBackupPlanDataSource_basic\|TestAccAWSBackupSelectionDataSource_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSBackupPlanDataSource_basic\|TestAccAWSBackupSelectionDataSource_basic -timeout 180m
=== RUN   TestAccAWSBackupPlanDataSource_basic
=== PAUSE TestAccAWSBackupPlanDataSource_basic
=== RUN   TestAccAWSBackupSelectionDataSource_basic
=== PAUSE TestAccAWSBackupSelectionDataSource_basic
=== CONT  TestAccAWSBackupPlanDataSource_basic
=== CONT  TestAccAWSBackupSelectionDataSource_basic
--- PASS: TestAccAWSBackupPlanDataSource_basic (22.62s)
--- PASS: TestAccAWSBackupSelectionDataSource_basic (24.02s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	26.951s

Before fix:

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSBackupPlanDataSource_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSBackupPlanDataSource_basic -timeout 180m
=== RUN   TestAccAWSBackupPlanDataSource_basic
=== PAUSE TestAccAWSBackupPlanDataSource_basic
=== CONT  TestAccAWSBackupPlanDataSource_basic
    data_source_aws_backup_plan_test.go:18: Step 2/2 error: Error running pre-apply plan: exit status 1
        2021/04/28 14:33:26 [DEBUG] Using modified User-Agent: Terraform/0.12.30 HashiCorp-terraform-exec/0.13.3

        Error: error setting new tags_all diff: SetNew: invalid key: tags_all

          on terraform_plugin_test.tf line 6, in resource "aws_backup_plan" "test":
           6: resource "aws_backup_plan" "test" {

--- FAIL: TestAccAWSBackupPlanDataSource_basic (5.09s)
FAIL
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	8.254s
FAIL
make: *** [testacc] Error 1

Acceptance test output:

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSBackupPlanDataSource_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSBackupPlanDataSource_basic -timeout 180m
=== RUN   TestAccAWSBackupPlanDataSource_basic
=== PAUSE TestAccAWSBackupPlanDataSource_basic
=== CONT  TestAccAWSBackupPlanDataSource_basic
--- PASS: TestAccAWSBackupPlanDataSource_basic (18.13s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	22.042s
@ewbankkit ewbankkit requested a review from a team as a code owner April 28, 2021 18:56
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/backup Issues and PRs that pertain to the backup service. labels Apr 28, 2021
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. labels Apr 28, 2021
@bflad bflad self-assigned this Apr 28, 2021
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.

Looks good to me, although it may be good to separately fix the potential for panic in tags.go, e.g. using (schema.ResourceDiff).GetOk or type assertion checks.

Output from acceptance testing:

--- PASS: TestAccAWSBackupPlanDataSource_basic (21.00s)

--- PASS: TestAccAWSBackupSelectionDataSource_basic (22.04s)

--- PASS: TestAccAwsBackupPlan_AdvancedBackupSetting (66.81s)
--- PASS: TestAccAwsBackupPlan_basic (46.54s)
--- PASS: TestAccAwsBackupPlan_disappears (38.67s)
--- PASS: TestAccAwsBackupPlan_EnableContinuousBackup (45.68s)
--- PASS: TestAccAwsBackupPlan_Rule_CopyAction_CrossRegion (57.45s)
--- PASS: TestAccAwsBackupPlan_Rule_CopyAction_Multiple (42.90s)
--- PASS: TestAccAwsBackupPlan_Rule_CopyAction_NoLifecycle (80.23s)
--- PASS: TestAccAwsBackupPlan_Rule_CopyAction_SameRegion (81.21s)
--- PASS: TestAccAwsBackupPlan_withLifecycle (90.12s)
--- PASS: TestAccAwsBackupPlan_withRecoveryPointTags (81.14s)
--- PASS: TestAccAwsBackupPlan_withRules (80.43s)
--- PASS: TestAccAwsBackupPlan_withTags (78.90s)

@ewbankkit
Copy link
Contributor Author

I thought about that but decided right now to leave as is - a panic catches the attention...

@ewbankkit ewbankkit merged commit 5d04b68 into main Apr 28, 2021
@ewbankkit ewbankkit deleted the b-fix-aws_backup-default_tags-errors branch April 28, 2021 19:49
@github-actions github-actions bot added this to the v3.38.0 milestone Apr 28, 2021
@ghost
Copy link

ghost commented Apr 30, 2021

This has been released in version 3.38.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!

@github-actions
Copy link

github-actions bot commented Jun 1, 2021

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 Jun 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/backup Issues and PRs that pertain to the backup service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants