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

service/ec2: Handle additional EIP association issues and remove EIP hardcoded us-east-1 environment variable handling in tests #16032

Merged
merged 1 commit into from
Nov 12, 2020

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Nov 5, 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

Reference: #8316
Reference: #15737
Closes #15791
Reference: #16018 (to run testing locally)

Release note for CHANGELOG:

* resource/aws_eip: In EC2-Classic, wait until Instance returns as associated during create or update
* resource/aws_eip_association: Retry on additional EC2 Address eventual consistency errors on creation
* resource/aws_eip_association: In EC2-Classic, wait until Instance returns as associated during creation

Previously in AWS Commercial:

=== RUN   TestAccAWSEIP_Ec2Classic
TestAccAWSEIP_Ec2Classic: resource_aws_eip_test.go:96: Step 1/2 error: After applying this test step, the plan was not empty.
stdout:
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# aws_eip.test will be updated in-place
~ resource "aws_eip" "test" {
domain           = "standard"
id               = "52.0.143.158"
+ instance         = "i-0c0a6ad483e281c59"
public_dns       = "ec2-52-0-143-158.compute-1.amazonaws.com"
public_ip        = "52.0.143.158"
public_ipv4_pool = "amazon"
vpc              = false
}
Plan: 0 to add, 1 to change, 0 to destroy.
--- FAIL: TestAccAWSEIP_Ec2Classic (153.41s)

=== CONT  TestAccAWSEIPAssociation_ec2Classic
    resource_aws_eip_association_test.go:97: Step 1/2 error: After applying this test step, the plan was not empty.
        stdout:

        An execution plan has been generated and is shown below.
        Resource actions are indicated with the following symbols:
        -/+ destroy and then create replacement

        Terraform will perform the following actions:

          # aws_eip_association.test must be replaced
        -/+ resource "aws_eip_association" "test" {
              + allocation_id        = (known after apply)
              ~ id                   = "34.224.14.254" -> (known after apply)
              + instance_id          = "i-0ab9e7598ae44485f"
              + network_interface_id = (known after apply)
              + private_ip_address   = (known after apply)
                public_ip            = "34.224.14.254"
            }

        Plan: 1 to add, 0 to change, 1 to destroy.
--- FAIL: TestAccAWSEIPAssociation_ec2Classic (74.15s)

=== CONT  TestAccAWSEIPAssociation_ec2Classic
    resource_aws_eip_association_test.go:97: Step 1/2 error: Error running apply: 2020/11/03 09:35:32 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0

        Error: Error associating EIP: AuthFailure: The address '34.239.37.205' does not belong to you.
          status code: 400, request id: d4163627-4987-4466-a297-aa2a48331dc9

=== CONT  TestAccAWSEIPAssociation_disappears
    resource_aws_eip_association_test.go:154: Step 1/1 error: Error running apply: 2020/11/03 09:35:33 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0

        Error: Error associating EIP: InvalidAllocationID.NotFound: The allocation ID 'eipalloc-0780b47e4b04f970a' does not exist
          status code: 400, request id: 2c1a4d76-0ec2-45d7-9427-89d6e5de03ec

=== CONT  TestAccAWSEIPAssociation_networkInterface
    resource_aws_eip_association_test.go:43: Step 1/2 error: Error running apply: 2020/11/03 09:35:30 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0

        Error: Error associating EIP: InvalidAllocationID.NotFound: The allocation ID 'eipalloc-071e65b698ca98f08' does not exist
          status code: 400, request id: 862d2320-e52a-45ef-854c-9cc90004bf77

Previously in AWS GovCloud (US):

=== RUN   TestAccAWSEIPAssociation_ec2Classic
TestAccAWSEIPAssociation_ec2Classic: provider_test.go:196: [{0 error configuring Terraform AWS Provider: error validating provider credentials: error calling sts:GetCallerIdentity: InvalidClientTokenId: The security token included in the request is invalid.
  status code: 403, request id: f2a9b7c4-2448-47a0-b5ea-87de84dd9b7a  []}]
--- FAIL: TestAccAWSEIPAssociation_ec2Classic (0.36s)

Output from acceptance testing in AWS Commercial:

--- PASS: TestAccAWSEIP_associated_user_private_ip (231.25s)
--- PASS: TestAccAWSEIP_basic (18.88s)
--- PASS: TestAccAWSEIP_disappears (12.62s)
--- PASS: TestAccAWSEIP_Ec2Classic (195.34s)
--- PASS: TestAccAWSEIP_instance (99.75s)
--- PASS: TestAccAWSEIP_Instance_Reassociate (126.92s)
--- PASS: TestAccAWSEIP_networkInterface (81.71s)
--- PASS: TestAccAWSEIP_notAssociated (144.46s)
--- PASS: TestAccAWSEIP_PublicIpv4Pool_default (18.84s)
--- PASS: TestAccAWSEIP_tags_Ec2Classic (7.61s)
--- PASS: TestAccAWSEIP_tags_Vpc (26.35s)
--- PASS: TestAccAWSEIP_twoEIPsOneNetworkInterface (82.93s)
--- SKIP: TestAccAWSEIP_CustomerOwnedIpv4Pool (2.47s)
--- SKIP: TestAccAWSEIP_PublicIpv4Pool_custom (0.00s)

--- PASS: TestAccAWSEIPAssociation_basic (159.35s)
--- PASS: TestAccAWSEIPAssociation_disappears (101.24s)
--- PASS: TestAccAWSEIPAssociation_ec2Classic (93.73s)
--- PASS: TestAccAWSEIPAssociation_instance (93.00s)
--- PASS: TestAccAWSEIPAssociation_networkInterface (71.25s)
--- PASS: TestAccAWSEIPAssociation_spotInstance (71.11s)

Output from acceptance testing in AWS GovCloud (US):

--- PASS: TestAccAWSEIP_associated_user_private_ip (245.88s)
--- PASS: TestAccAWSEIP_basic (23.76s)
--- PASS: TestAccAWSEIP_disappears (16.42s)
--- PASS: TestAccAWSEIP_instance (107.18s)
--- PASS: TestAccAWSEIP_Instance_Reassociate (165.24s)
--- PASS: TestAccAWSEIP_networkInterface (90.37s)
--- PASS: TestAccAWSEIP_notAssociated (146.54s)
--- PASS: TestAccAWSEIP_PublicIpv4Pool_default (24.04s)
--- PASS: TestAccAWSEIP_tags_Vpc (37.31s)
--- PASS: TestAccAWSEIP_twoEIPsOneNetworkInterface (90.85s)
--- SKIP: TestAccAWSEIP_CustomerOwnedIpv4Pool (2.86s)
--- SKIP: TestAccAWSEIP_Ec2Classic (2.89s)
--- SKIP: TestAccAWSEIP_PublicIpv4Pool_custom (0.00s)
--- SKIP: TestAccAWSEIP_tags_Ec2Classic (2.89s)

--- PASS: TestAccAWSEIPAssociation_basic (156.32s)
--- PASS: TestAccAWSEIPAssociation_disappears (130.31s)
--- PASS: TestAccAWSEIPAssociation_instance (89.29s)
--- PASS: TestAccAWSEIPAssociation_networkInterface (79.42s)
--- PASS: TestAccAWSEIPAssociation_spotInstance (68.02s)
--- SKIP: TestAccAWSEIPAssociation_ec2Classic (2.92s)

…hardcoded us-east-1 environment variable handling in tests

Reference: #8316
Reference: #15737
Reference: #15791
Reference: #16018 (to run testing locally)

Changes:

```
* resource/aws_eip: In EC2-Classic, wait until Instance returns as associated during create or update
* resource/aws_eip_association: Retry on additional EC2 Address eventual consistency errors on creation
* resource/aws_eip_association: In EC2-Classic, wait until Instance returns as associated during creation
```

Previously in AWS Commercial:

```
=== RUN   TestAccAWSEIP_Ec2Classic
TestAccAWSEIP_Ec2Classic: resource_aws_eip_test.go:96: Step 1/2 error: After applying this test step, the plan was not empty.
stdout:
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# aws_eip.test will be updated in-place
~ resource "aws_eip" "test" {
domain           = "standard"
id               = "52.0.143.158"
+ instance         = "i-0c0a6ad483e281c59"
public_dns       = "ec2-52-0-143-158.compute-1.amazonaws.com"
public_ip        = "52.0.143.158"
public_ipv4_pool = "amazon"
vpc              = false
}
Plan: 0 to add, 1 to change, 0 to destroy.
--- FAIL: TestAccAWSEIP_Ec2Classic (153.41s)

=== CONT  TestAccAWSEIPAssociation_ec2Classic
    resource_aws_eip_association_test.go:97: Step 1/2 error: After applying this test step, the plan was not empty.
        stdout:

        An execution plan has been generated and is shown below.
        Resource actions are indicated with the following symbols:
        -/+ destroy and then create replacement

        Terraform will perform the following actions:

          # aws_eip_association.test must be replaced
        -/+ resource "aws_eip_association" "test" {
              + allocation_id        = (known after apply)
              ~ id                   = "34.224.14.254" -> (known after apply)
              + instance_id          = "i-0ab9e7598ae44485f"
              + network_interface_id = (known after apply)
              + private_ip_address   = (known after apply)
                public_ip            = "34.224.14.254"
            }

        Plan: 1 to add, 0 to change, 1 to destroy.
--- FAIL: TestAccAWSEIPAssociation_ec2Classic (74.15s)

=== CONT  TestAccAWSEIPAssociation_ec2Classic
    resource_aws_eip_association_test.go:97: Step 1/2 error: Error running apply: 2020/11/03 09:35:32 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0

        Error: Error associating EIP: AuthFailure: The address '34.239.37.205' does not belong to you.
          status code: 400, request id: d4163627-4987-4466-a297-aa2a48331dc9

=== CONT  TestAccAWSEIPAssociation_disappears
    resource_aws_eip_association_test.go:154: Step 1/1 error: Error running apply: 2020/11/03 09:35:33 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0

        Error: Error associating EIP: InvalidAllocationID.NotFound: The allocation ID 'eipalloc-0780b47e4b04f970a' does not exist
          status code: 400, request id: 2c1a4d76-0ec2-45d7-9427-89d6e5de03ec

=== CONT  TestAccAWSEIPAssociation_networkInterface
    resource_aws_eip_association_test.go:43: Step 1/2 error: Error running apply: 2020/11/03 09:35:30 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0

        Error: Error associating EIP: InvalidAllocationID.NotFound: The allocation ID 'eipalloc-071e65b698ca98f08' does not exist
          status code: 400, request id: 862d2320-e52a-45ef-854c-9cc90004bf77
```

Previously in AWS GovCloud (US):

```
=== RUN   TestAccAWSEIPAssociation_ec2Classic
TestAccAWSEIPAssociation_ec2Classic: provider_test.go:196: [{0 error configuring Terraform AWS Provider: error validating provider credentials: error calling sts:GetCallerIdentity: InvalidClientTokenId: The security token included in the request is invalid.
  status code: 403, request id: f2a9b7c4-2448-47a0-b5ea-87de84dd9b7a  []}]
--- FAIL: TestAccAWSEIPAssociation_ec2Classic (0.36s)
```

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSEIP_associated_user_private_ip (231.25s)
--- PASS: TestAccAWSEIP_basic (18.88s)
--- PASS: TestAccAWSEIP_disappears (12.62s)
--- PASS: TestAccAWSEIP_Ec2Classic (195.34s)
--- PASS: TestAccAWSEIP_instance (99.75s)
--- PASS: TestAccAWSEIP_Instance_Reassociate (126.92s)
--- PASS: TestAccAWSEIP_networkInterface (81.71s)
--- PASS: TestAccAWSEIP_notAssociated (144.46s)
--- PASS: TestAccAWSEIP_PublicIpv4Pool_default (18.84s)
--- PASS: TestAccAWSEIP_tags_Ec2Classic (7.61s)
--- PASS: TestAccAWSEIP_tags_Vpc (26.35s)
--- PASS: TestAccAWSEIP_twoEIPsOneNetworkInterface (82.93s)
--- SKIP: TestAccAWSEIP_CustomerOwnedIpv4Pool (2.47s)
--- SKIP: TestAccAWSEIP_PublicIpv4Pool_custom (0.00s)

--- PASS: TestAccAWSEIPAssociation_basic (159.35s)
--- PASS: TestAccAWSEIPAssociation_disappears (101.24s)
--- PASS: TestAccAWSEIPAssociation_ec2Classic (93.73s)
--- PASS: TestAccAWSEIPAssociation_instance (93.00s)
--- PASS: TestAccAWSEIPAssociation_networkInterface (71.25s)
--- PASS: TestAccAWSEIPAssociation_spotInstance (71.11s)
```

Output from acceptance testing in AWS GovCloud (US):

```
--- PASS: TestAccAWSEIP_associated_user_private_ip (245.88s)
--- PASS: TestAccAWSEIP_basic (23.76s)
--- PASS: TestAccAWSEIP_disappears (16.42s)
--- PASS: TestAccAWSEIP_instance (107.18s)
--- PASS: TestAccAWSEIP_Instance_Reassociate (165.24s)
--- PASS: TestAccAWSEIP_networkInterface (90.37s)
--- PASS: TestAccAWSEIP_notAssociated (146.54s)
--- PASS: TestAccAWSEIP_PublicIpv4Pool_default (24.04s)
--- PASS: TestAccAWSEIP_tags_Vpc (37.31s)
--- PASS: TestAccAWSEIP_twoEIPsOneNetworkInterface (90.85s)
--- SKIP: TestAccAWSEIP_CustomerOwnedIpv4Pool (2.86s)
--- SKIP: TestAccAWSEIP_Ec2Classic (2.89s)
--- SKIP: TestAccAWSEIP_PublicIpv4Pool_custom (0.00s)
--- SKIP: TestAccAWSEIP_tags_Ec2Classic (2.89s)

--- PASS: TestAccAWSEIPAssociation_basic (156.32s)
--- PASS: TestAccAWSEIPAssociation_disappears (130.31s)
--- PASS: TestAccAWSEIPAssociation_instance (89.29s)
--- PASS: TestAccAWSEIPAssociation_networkInterface (79.42s)
--- PASS: TestAccAWSEIPAssociation_spotInstance (68.02s)
--- SKIP: TestAccAWSEIPAssociation_ec2Classic (2.92s)
```
@bflad bflad added the bug Addresses a defect in current functionality. label Nov 5, 2020
@bflad bflad requested a review from a team as a code owner November 5, 2020 00:01
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Nov 5, 2020
@YakDriver YakDriver self-assigned this Nov 12, 2020
@YakDriver
Copy link
Member

Hmmm... Having some issues with commercial:

--- FAIL: TestAccAWSEIP_disappears (15.04s)
--- FAIL: TestAccAWSEIP_Ec2Classic (194.51s)
--- FAIL: TestAccAWSEIP_instance (44.96s)
--- FAIL: TestAccAWSEIP_Instance_Reassociate (345.52s)
--- FAIL: TestAccAWSEIP_tags_Vpc (10.97s)
--- FAIL: TestAccAWSEIPAssociation_disappears (207.02s)
--- FAIL: TestAccAWSEIPAssociation_ec2Classic (211.82s)
--- PASS: TestAccAWSEIP_associated_user_private_ip (229.84s)
--- PASS: TestAccAWSEIP_basic (18.67s)
--- PASS: TestAccAWSEIP_networkInterface (80.29s)
--- PASS: TestAccAWSEIP_notAssociated (124.36s)
--- PASS: TestAccAWSEIP_PublicIpv4Pool_default (18.74s)
--- PASS: TestAccAWSEIP_tags_Ec2Classic (7.83s)
--- PASS: TestAccAWSEIP_twoEIPsOneNetworkInterface (81.74s)
--- PASS: TestAccAWSEIPAssociation_basic (180.63s)
--- PASS: TestAccAWSEIPAssociation_instance (102.86s)
--- PASS: TestAccAWSEIPAssociation_networkInterface (72.68s)
--- PASS: TestAccAWSEIPAssociation_spotInstance (313.29s)
--- SKIP: TestAccAWSEIP_CustomerOwnedIpv4Pool (2.41s)
--- SKIP: TestAccAWSEIP_PublicIpv4Pool_custom (0.00s)

GovCloud looks good:

--- SKIP: TestAccAWSEIP_CustomerOwnedIpv4Pool (2.74s)
--- SKIP: TestAccAWSEIP_Ec2Classic (2.97s)
--- SKIP: TestAccAWSEIP_tags_Ec2Classic (2.98s)
--- SKIP: TestAccAWSEIPAssociation_ec2Classic (2.98s)
--- PASS: TestAccAWSEIP_disappears (15.42s)
--- PASS: TestAccAWSEIP_PublicIpv4Pool_default (22.16s)
--- PASS: TestAccAWSEIP_basic (22.86s)
--- PASS: TestAccAWSEIP_tags_Vpc (33.38s)
--- PASS: TestAccAWSEIPAssociation_networkInterface (75.64s)
--- PASS: TestAccAWSEIP_networkInterface (86.18s)
--- PASS: TestAccAWSEIP_twoEIPsOneNetworkInterface (86.79s)
--- PASS: TestAccAWSEIP_instance (87.92s)
--- PASS: TestAccAWSEIPAssociation_spotInstance (94.79s)
--- PASS: TestAccAWSEIPAssociation_instance (97.75s)
--- PASS: TestAccAWSEIPAssociation_disappears (107.32s)
--- PASS: TestAccAWSEIP_notAssociated (120.50s)
--- PASS: TestAccAWSEIP_Instance_Reassociate (150.71s)
--- PASS: TestAccAWSEIPAssociation_basic (184.41s)
--- PASS: TestAccAWSEIP_associated_user_private_ip (216.00s)

@YakDriver
Copy link
Member

Run serially, the tests are fine on commercial. Is the same parallel issue fixed in #16018?

Commercial, serially:

--- PASS: TestAccAWSEIP_instance (96.74s)
--- PASS: TestAccAWSEIP_tags_Vpc (21.43s)
--- PASS: TestAccAWSEIPAssociation_disappears (99.67s)
--- PASS: TestAccAWSEIP_disappears (9.47s)
--- PASS: TestAccAWSEIP_Ec2Classic (99.74s)
--- PASS: TestAccAWSEIP_Instance_Reassociate (153.42s)
--- PASS: TestAccAWSEIPAssociation_ec2Classic (222.80s)

Copy link
Member

@YakDriver YakDriver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Underbar! 🥇

@YakDriver YakDriver added the partition/aws-us-gov Pertains to the aws-us-gov partition. label Nov 12, 2020
@bflad
Copy link
Contributor Author

bflad commented Nov 12, 2020

@YakDriver indeed that concurrency issue is what #16018 intends to fix (making testAccProviderFactories an actual factory) and how I wound up with these two interleaved issues/PRs. Sorry for the confusion. 😖

@bflad bflad added this to the v3.15.0 milestone Nov 12, 2020
@bflad bflad merged commit 380460d into master Nov 12, 2020
@bflad bflad deleted the b-ec2-eip-tests-and-retries branch November 12, 2020 13:47
bflad added a commit that referenced this pull request Nov 12, 2020
@ghost
Copy link

ghost commented Nov 12, 2020

This has been released in version 3.15.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 Dec 12, 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 as resolved and limited conversation to collaborators Dec 12, 2020
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. partition/aws-us-gov Pertains to the aws-us-gov partition. 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.

Acceptance testing: Create EC2-Classic alternate test provider
2 participants