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

[WIP] New resource aws_ec2_public_ipv4_pool #35750

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

StephenKing
Copy link
Contributor

Description

Implement the aws_ec2_public_ipv4_pool resource, which is a prerequisite for using a public IPAM pool as Elastic IP addresses (requires follow-up implementation of aws_ec2_ip4v_pool_cidr_provision).

Relations

Relates #33194

References

Output from Acceptance Testing

TF_LOG=warn make testacc TESTS=TestAccEC2PublicIPv4Pool PKG=ec2      
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2PublicIPv4Pool'  -timeout 360m
=== RUN   TestAccEC2PublicIPv4PoolDataSource_basic
=== PAUSE TestAccEC2PublicIPv4PoolDataSource_basic
=== RUN   TestAccEC2PublicIPv4Pool_basic
=== PAUSE TestAccEC2PublicIPv4Pool_basic
=== RUN   TestAccEC2PublicIPv4Pool_disappears
=== PAUSE TestAccEC2PublicIPv4Pool_disappears
=== RUN   TestAccEC2PublicIPv4PoolsDataSource_basic
=== PAUSE TestAccEC2PublicIPv4PoolsDataSource_basic
=== RUN   TestAccEC2PublicIPv4PoolsDataSource_tags
=== PAUSE TestAccEC2PublicIPv4PoolsDataSource_tags
=== CONT  TestAccEC2PublicIPv4PoolDataSource_basic
=== CONT  TestAccEC2PublicIPv4PoolsDataSource_basic
=== CONT  TestAccEC2PublicIPv4Pool_disappears
=== CONT  TestAccEC2PublicIPv4Pool_basic
=== CONT  TestAccEC2PublicIPv4PoolsDataSource_tags
2024/02/10 14:57:14 [WARN] total_address_count(0): Int64 Type Validation Error

An unexpected error was encountered trying to validate an attribute value. This is always an error in the provider. Please report the following to the provider developer:

Expected Number value, received tftypes.Value with value: tftypes.String<"0">
total_address_count
2024/02/10 14:57:14 [WARN] total_available_address_count(0): Int64 Type Validation Error

An unexpected error was encountered trying to validate an attribute value. This is always an error in the provider. Please report the following to the provider developer:

Expected Number value, received tftypes.Value with value: tftypes.String<"0">
total_available_address_count
2024-02-10T14:57:14.030+0100 [WARN]  acctest: DELETE start: test_name=TestAccEC2PublicIPv4Pool_disappears
2024-02-10T14:57:14.030+0100 [WARN]  acctest: DELETE doing delete: test_name=TestAccEC2PublicIPv4Pool_disappears
2024-02-10T14:57:30.128+0100 [WARN]  aws: Public IPv4 Pool not found during findPublicIPv4PoolByID: tf_req_id=2a644b5c-f3fc-e73c-899b-dd7ad666131a tf_rpc=ReadResource tf_resource_type=aws_ec2_public_ipv4_pool tf_mux_provider="*proto5server.Server" id=ipv4pool-ec2-0e615df99db894bd8 tf_provider_addr=registry.terraform.io/hashicorp/aws
2024-02-10T14:57:30.128+0100 [WARN]  aws: Public IPv4 Pool not found, removing from state: id=ipv4pool-ec2-0e615df99db894bd8 tf_resource_type=aws_ec2_public_ipv4_pool tf_mux_provider="*proto5server.Server" tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=2a644b5c-f3fc-e73c-899b-dd7ad666131a tf_rpc=ReadResource
--- PASS: TestAccEC2PublicIPv4PoolsDataSource_basic (55.50s)
--- PASS: TestAccEC2PublicIPv4PoolsDataSource_tags (55.97s)
2024-02-10T14:58:06.747+0100 [WARN]  sdk.helper_schema: Previously configured provider being re-configured. This can cause issues in concurrent testing if the configurations are not equal.: tf_mux_provider="*schema.GRPCProviderServer" tf_req_id=3fb8cb46-f287-eacf-e7c1-0aee2455ca35 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ConfigureProvider
2024-02-10T14:58:07.245+0100 [WARN]  aws: DELETE start: tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ApplyResourceChange tf_resource_type=aws_ec2_public_ipv4_pool tf_req_id=6a07ad89-c9ad-03c0-fa31-dcc21b00511d tf_mux_provider="*proto5server.Server"
2024-02-10T14:58:07.245+0100 [WARN]  aws: DELETE doing delete: tf_req_id=6a07ad89-c9ad-03c0-fa31-dcc21b00511d tf_mux_provider="*proto5server.Server" tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ApplyResourceChange tf_resource_type=aws_ec2_public_ipv4_pool
2024-02-10T14:58:07.852+0100 [WARN]  aws: DELETE in error return: tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ApplyResourceChange tf_resource_type=aws_ec2_public_ipv4_pool tf_req_id=6a07ad89-c9ad-03c0-fa31-dcc21b00511d tf_mux_provider="*proto5server.Server"
2024-02-10T14:58:08.041+0100 [ERROR] sdk.helper_resource: Error running post-test destroy, there may be dangling resources: test_terraform_path=/opt/homebrew/bin/terraform test_working_directory=/var/folders/pp/4c__1grn2z98n24s1v020b3h0000gq/T/plugintest944978395 test_step_number=1 error="checking destroyed Amazon EC2 (Elastic Compute Cloud) Public IPv4 Pool (ipv4pool-ec2-0e615df99db894bd8): operation error EC2: DescribePublicIpv4Pools, https response error StatusCode: 400, RequestID: 20f027bd-f623-48d3-bd98-653d5966baa5, api error InvalidPublicIpv4PoolID.NotFound: The pool ID 'ipv4pool-ec2-0e615df99db894bd8' does not exist." test_name=TestAccEC2PublicIPv4Pool_disappears
=== NAME  TestAccEC2PublicIPv4Pool_disappears
    testing_new.go:91: Error running post-test destroy, there may be dangling resources: checking destroyed Amazon EC2 (Elastic Compute Cloud) Public IPv4 Pool (ipv4pool-ec2-0e615df99db894bd8): operation error EC2: DescribePublicIpv4Pools, https response error StatusCode: 400, RequestID: 20f027bd-f623-48d3-bd98-653d5966baa5, api error InvalidPublicIpv4PoolID.NotFound: The pool ID 'ipv4pool-ec2-0e615df99db894bd8' does not exist.
--- FAIL: TestAccEC2PublicIPv4Pool_disappears (71.39s)
2024-02-10T14:58:11.271+0100 [WARN]  sdk.helper_schema: Previously configured provider being re-configured. This can cause issues in concurrent testing if the configurations are not equal.: tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ConfigureProvider tf_mux_provider="*schema.GRPCProviderServer" tf_req_id=c11b6dbd-da78-4e5d-e04c-e5f4cfa57c54
2024-02-10T14:58:11.879+0100 [WARN]  aws: DELETE start: tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ApplyResourceChange tf_mux_provider="*proto5server.Server" tf_resource_type=aws_ec2_public_ipv4_pool tf_req_id=d9edd012-44e4-7af4-8b40-b882698e355d
2024-02-10T14:58:11.880+0100 [WARN]  aws: DELETE doing delete: tf_mux_provider="*proto5server.Server" tf_resource_type=aws_ec2_public_ipv4_pool tf_req_id=d9edd012-44e4-7af4-8b40-b882698e355d tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ApplyResourceChange
2024-02-10T14:58:12.746+0100 [ERROR] sdk.helper_resource: Error running post-test destroy, there may be dangling resources: test_step_number=2 test_name=TestAccEC2PublicIPv4Pool_basic test_terraform_path=/opt/homebrew/bin/terraform test_working_directory=/var/folders/pp/4c__1grn2z98n24s1v020b3h0000gq/T/plugintest2805901954 error="checking destroyed Amazon EC2 (Elastic Compute Cloud) Public IPv4 Pool (ipv4pool-ec2-0688ef02d40fba6b3): operation error EC2: DescribePublicIpv4Pools, https response error StatusCode: 400, RequestID: e530a9f8-65f8-4ce2-884f-740a62c1b772, api error InvalidPublicIpv4PoolID.NotFound: The pool ID 'ipv4pool-ec2-0688ef02d40fba6b3' does not exist."
=== NAME  TestAccEC2PublicIPv4Pool_basic
    testing_new.go:91: Error running post-test destroy, there may be dangling resources: checking destroyed Amazon EC2 (Elastic Compute Cloud) Public IPv4 Pool (ipv4pool-ec2-0688ef02d40fba6b3): operation error EC2: DescribePublicIpv4Pools, https response error StatusCode: 400, RequestID: e530a9f8-65f8-4ce2-884f-740a62c1b772, api error InvalidPublicIpv4PoolID.NotFound: The pool ID 'ipv4pool-ec2-0688ef02d40fba6b3' does not exist.
--- FAIL: TestAccEC2PublicIPv4Pool_basic (76.10s)
--- PASS: TestAccEC2PublicIPv4PoolDataSource_basic (89.41s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/ec2        96.101s
FAIL
make: *** [testacc] Error 1

Copy link

Community Note

Voting for Prioritization

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

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/ec2 Issues and PRs that pertain to the ec2 service. generators Relates to code generators. service/vpc Issues and PRs that pertain to the vpc service. size/XL Managed by automation to categorize the size of a PR. labels Feb 10, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 10, 2024
@StephenKing
Copy link
Contributor Author

It's my first contribution of a new resource. Any help would be appreciated with

  • verifying the resource was not found (neither tfawserr.ErrCodeEquals(err, errCodeInvalidPublicIpv4PoolIDNotFound) nor tfresource.NotFound(err) work)
  • failing disappear test
  • how to fix the Expected Number value, received tftypes.Value with value: tftypes.String<"0"> for the two int64 attributes as included in the acc tests

@justinretzolk justinretzolk 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 Feb 12, 2024
Still lacking implementation of correct not found handling
as well as disappear test fails.
@StephenKing StephenKing force-pushed the f-ec2-public-ipv4-pool branch from 5b8ac37 to d143181 Compare February 12, 2024 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. generators Relates to code generators. service/ec2 Issues and PRs that pertain to the ec2 service. service/vpc Issues and PRs that pertain to the vpc 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.

2 participants