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_ec2_availability_zone_group: Prevent crash on unknown group name #24422

Merged
merged 7 commits into from
Apr 26, 2022

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Apr 26, 2022

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 #24391.

Output from acceptance testing:

% make testacc TESTS=TestAccEC2AvailabilityZoneGroup_ PKG=ec2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2AvailabilityZoneGroup_'  -timeout 180m
=== RUN   TestAccEC2AvailabilityZoneGroup_optInStatus
=== PAUSE TestAccEC2AvailabilityZoneGroup_optInStatus
=== CONT  TestAccEC2AvailabilityZoneGroup_optInStatus
--- PASS: TestAccEC2AvailabilityZoneGroup_optInStatus (27.42s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	35.482s
% make testacc TESTS=TestAccEC2AvailabilityZoneDataSource_ PKG=ec2 ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 2 -run='TestAccEC2AvailabilityZoneDataSource_'  -timeout 180m
=== RUN   TestAccEC2AvailabilityZoneDataSource_allAvailabilityZones
=== PAUSE TestAccEC2AvailabilityZoneDataSource_allAvailabilityZones
=== RUN   TestAccEC2AvailabilityZoneDataSource_filter
=== PAUSE TestAccEC2AvailabilityZoneDataSource_filter
=== RUN   TestAccEC2AvailabilityZoneDataSource_localZone
=== PAUSE TestAccEC2AvailabilityZoneDataSource_localZone
=== RUN   TestAccEC2AvailabilityZoneDataSource_name
=== PAUSE TestAccEC2AvailabilityZoneDataSource_name
=== RUN   TestAccEC2AvailabilityZoneDataSource_wavelengthZone
=== PAUSE TestAccEC2AvailabilityZoneDataSource_wavelengthZone
=== RUN   TestAccEC2AvailabilityZoneDataSource_zoneID
=== PAUSE TestAccEC2AvailabilityZoneDataSource_zoneID
=== CONT  TestAccEC2AvailabilityZoneDataSource_allAvailabilityZones
=== CONT  TestAccEC2AvailabilityZoneDataSource_name
--- PASS: TestAccEC2AvailabilityZoneDataSource_allAvailabilityZones (13.86s)
=== CONT  TestAccEC2AvailabilityZoneDataSource_zoneID
--- PASS: TestAccEC2AvailabilityZoneDataSource_name (14.48s)
=== CONT  TestAccEC2AvailabilityZoneDataSource_localZone
--- PASS: TestAccEC2AvailabilityZoneDataSource_zoneID (10.75s)
=== CONT  TestAccEC2AvailabilityZoneDataSource_wavelengthZone
--- PASS: TestAccEC2AvailabilityZoneDataSource_localZone (10.46s)
=== CONT  TestAccEC2AvailabilityZoneDataSource_filter
--- PASS: TestAccEC2AvailabilityZoneDataSource_wavelengthZone (10.51s)
--- PASS: TestAccEC2AvailabilityZoneDataSource_filter (10.34s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	39.496s
% make testacc TESTS=TestAccEC2SpotInstanceRequest_ PKG=ec2 ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 3 -run='TestAccEC2SpotInstanceRequest_'  -timeout 180m
=== RUN   TestAccEC2SpotInstanceRequest_basic
=== PAUSE TestAccEC2SpotInstanceRequest_basic
=== RUN   TestAccEC2SpotInstanceRequest_disappears
=== PAUSE TestAccEC2SpotInstanceRequest_disappears
=== RUN   TestAccEC2SpotInstanceRequest_tags
=== PAUSE TestAccEC2SpotInstanceRequest_tags
=== RUN   TestAccEC2SpotInstanceRequest_keyName
=== PAUSE TestAccEC2SpotInstanceRequest_keyName
=== RUN   TestAccEC2SpotInstanceRequest_withLaunchGroup
=== PAUSE TestAccEC2SpotInstanceRequest_withLaunchGroup
=== RUN   TestAccEC2SpotInstanceRequest_withBlockDuration
=== PAUSE TestAccEC2SpotInstanceRequest_withBlockDuration
=== RUN   TestAccEC2SpotInstanceRequest_vpc
=== PAUSE TestAccEC2SpotInstanceRequest_vpc
=== RUN   TestAccEC2SpotInstanceRequest_validUntil
=== PAUSE TestAccEC2SpotInstanceRequest_validUntil
=== RUN   TestAccEC2SpotInstanceRequest_withoutSpotPrice
=== PAUSE TestAccEC2SpotInstanceRequest_withoutSpotPrice
=== RUN   TestAccEC2SpotInstanceRequest_subnetAndSGAndPublicIPAddress
=== PAUSE TestAccEC2SpotInstanceRequest_subnetAndSGAndPublicIPAddress
=== RUN   TestAccEC2SpotInstanceRequest_networkInterfaceAttributes
=== PAUSE TestAccEC2SpotInstanceRequest_networkInterfaceAttributes
=== RUN   TestAccEC2SpotInstanceRequest_getPasswordData
=== PAUSE TestAccEC2SpotInstanceRequest_getPasswordData
=== RUN   TestAccEC2SpotInstanceRequest_interruptStop
=== PAUSE TestAccEC2SpotInstanceRequest_interruptStop
=== RUN   TestAccEC2SpotInstanceRequest_interruptHibernate
=== PAUSE TestAccEC2SpotInstanceRequest_interruptHibernate
=== RUN   TestAccEC2SpotInstanceRequest_interruptUpdate
=== PAUSE TestAccEC2SpotInstanceRequest_interruptUpdate
=== CONT  TestAccEC2SpotInstanceRequest_basic
=== CONT  TestAccEC2SpotInstanceRequest_withoutSpotPrice
=== CONT  TestAccEC2SpotInstanceRequest_withLaunchGroup
--- PASS: TestAccEC2SpotInstanceRequest_withLaunchGroup (75.62s)
=== CONT  TestAccEC2SpotInstanceRequest_validUntil
--- PASS: TestAccEC2SpotInstanceRequest_basic (93.76s)
=== CONT  TestAccEC2SpotInstanceRequest_vpc
--- PASS: TestAccEC2SpotInstanceRequest_withoutSpotPrice (94.60s)
=== CONT  TestAccEC2SpotInstanceRequest_withBlockDuration
--- PASS: TestAccEC2SpotInstanceRequest_validUntil (108.45s)
=== CONT  TestAccEC2SpotInstanceRequest_tags
--- PASS: TestAccEC2SpotInstanceRequest_vpc (109.36s)
=== CONT  TestAccEC2SpotInstanceRequest_keyName
--- PASS: TestAccEC2SpotInstanceRequest_withBlockDuration (116.61s)
=== CONT  TestAccEC2SpotInstanceRequest_networkInterfaceAttributes
--- PASS: TestAccEC2SpotInstanceRequest_keyName (117.73s)
=== CONT  TestAccEC2SpotInstanceRequest_getPasswordData
--- PASS: TestAccEC2SpotInstanceRequest_networkInterfaceAttributes (128.62s)
=== CONT  TestAccEC2SpotInstanceRequest_interruptUpdate
--- PASS: TestAccEC2SpotInstanceRequest_tags (205.03s)
=== CONT  TestAccEC2SpotInstanceRequest_subnetAndSGAndPublicIPAddress
--- PASS: TestAccEC2SpotInstanceRequest_getPasswordData (165.21s)
=== CONT  TestAccEC2SpotInstanceRequest_disappears
--- PASS: TestAccEC2SpotInstanceRequest_subnetAndSGAndPublicIPAddress (131.59s)
=== CONT  TestAccEC2SpotInstanceRequest_interruptHibernate
--- PASS: TestAccEC2SpotInstanceRequest_interruptUpdate (204.42s)
=== CONT  TestAccEC2SpotInstanceRequest_interruptStop
--- PASS: TestAccEC2SpotInstanceRequest_interruptHibernate (124.37s)
--- PASS: TestAccEC2SpotInstanceRequest_interruptStop (102.61s)
--- PASS: TestAccEC2SpotInstanceRequest_disappears (345.63s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	835.807s

…: true'.

Acceptance test output:

% make testacc TESTS=TestAccEC2AvailabilityZoneGroup_ PKG=ec2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2AvailabilityZoneGroup_'  -timeout 180m
=== RUN   TestAccEC2AvailabilityZoneGroup_optInStatus
=== PAUSE TestAccEC2AvailabilityZoneGroup_optInStatus
=== CONT  TestAccEC2AvailabilityZoneGroup_optInStatus
--- PASS: TestAccEC2AvailabilityZoneGroup_optInStatus (27.42s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	35.482s
@github-actions github-actions bot added service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/L Managed by automation to categorize the size of a PR. labels Apr 26, 2022
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. labels Apr 26, 2022
@ewbankkit
Copy link
Contributor Author

Instead of crashing when an unknown AZ group name is configured, an error is reported:

% terraform apply

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following
symbols:
  + create

Terraform will perform the following actions:

  # aws_ec2_availability_zone_group.example will be created
  + resource "aws_ec2_availability_zone_group" "example" {
      + group_name    = "test"
      + id            = (known after apply)
      + opt_in_status = "opted-in"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_ec2_availability_zone_group.example: Creating...
╷
│ Error: reading EC2 Availability Zone Group (test): empty result
│ 
│   with aws_ec2_availability_zone_group.example,
│   on main.tf line 3, in resource "aws_ec2_availability_zone_group" "example":
│    3: resource "aws_ec2_availability_zone_group" "example" {
│ 
╵

Acceptance test output:

% make testacc TESTS=TestAccEC2AvailabilityZoneDataSource_ PKG=ec2 ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 2 -run='TestAccEC2AvailabilityZoneDataSource_'  -timeout 180m
=== RUN   TestAccEC2AvailabilityZoneDataSource_allAvailabilityZones
=== PAUSE TestAccEC2AvailabilityZoneDataSource_allAvailabilityZones
=== RUN   TestAccEC2AvailabilityZoneDataSource_filter
=== PAUSE TestAccEC2AvailabilityZoneDataSource_filter
=== RUN   TestAccEC2AvailabilityZoneDataSource_localZone
=== PAUSE TestAccEC2AvailabilityZoneDataSource_localZone
=== RUN   TestAccEC2AvailabilityZoneDataSource_name
=== PAUSE TestAccEC2AvailabilityZoneDataSource_name
=== RUN   TestAccEC2AvailabilityZoneDataSource_wavelengthZone
=== PAUSE TestAccEC2AvailabilityZoneDataSource_wavelengthZone
=== RUN   TestAccEC2AvailabilityZoneDataSource_zoneID
=== PAUSE TestAccEC2AvailabilityZoneDataSource_zoneID
=== CONT  TestAccEC2AvailabilityZoneDataSource_allAvailabilityZones
=== CONT  TestAccEC2AvailabilityZoneDataSource_name
--- PASS: TestAccEC2AvailabilityZoneDataSource_allAvailabilityZones (13.86s)
=== CONT  TestAccEC2AvailabilityZoneDataSource_zoneID
--- PASS: TestAccEC2AvailabilityZoneDataSource_name (14.48s)
=== CONT  TestAccEC2AvailabilityZoneDataSource_localZone
--- PASS: TestAccEC2AvailabilityZoneDataSource_zoneID (10.75s)
=== CONT  TestAccEC2AvailabilityZoneDataSource_wavelengthZone
--- PASS: TestAccEC2AvailabilityZoneDataSource_localZone (10.46s)
=== CONT  TestAccEC2AvailabilityZoneDataSource_filter
--- PASS: TestAccEC2AvailabilityZoneDataSource_wavelengthZone (10.51s)
--- PASS: TestAccEC2AvailabilityZoneDataSource_filter (10.34s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	39.496s
@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. service/wavelength Issues and PRs that pertain to the wavelength service. and removed size/L Managed by automation to categorize the size of a PR. labels Apr 26, 2022
@ewbankkit ewbankkit removed the service/wavelength Issues and PRs that pertain to the wavelength service. label Apr 26, 2022
@ewbankkit ewbankkit merged commit 9dadb50 into main Apr 26, 2022
@ewbankkit ewbankkit deleted the b-aws_ec2_availability_zone_group-crash branch April 26, 2022 19:13
@github-actions github-actions bot added this to the v4.12.0 milestone Apr 26, 2022
github-actions bot pushed a commit that referenced this pull request Apr 26, 2022
@github-actions
Copy link

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

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 29, 2022
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/ec2 Issues and PRs that pertain to the ec2 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_ec2_availability_zone_group create crashes provider v4.10.0
1 participant