-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Bug]: IPAM allocation fails with "InvalidIpamPoolAllocationId" #28913
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
We're seeing similar issues with that resource as well (using 4.50.0). First attempt
|
We have the exact same problem as @Tailzip. We are referencing the cidr in a local. It seems that the local is being evaluated way too early. The terraform resource might indicate that the allocation is done, but it seems like it's still ongoing asynchronously in AWS. We tried to remove the tainted resource and then import the resource, but that doesn't seem to work. Afterwards it showed us a completely new resource being created. Applying that will result in the mentioned error again ("couldn't find resource"). EDIT: We verified the problem with 4.19.0, 4.46.0 and 4.48.0. It seems that it started last week as sporadic behavior, but now this is a constant behavior. |
Potentially related: #25300 |
Hi @Tailzip - Can you tell me the CLI steps to reproduce. When I do the following AWS will not support unless we show them that their CLI also fails |
I've been running the following script, and issue happens randomly after a couple runs script.sh#!/bin/bash
set -e
export AWS_REGION=eu-central-1
export AWS_DEFAULT_REGION=eu-central-1
export AWS_DEFAULT_OUTPUT=json
IPAM_POOL_ID="ipam-pool-xxxxxxxxxxxxxxxxx"
ALLOCATION_ID="$(aws ec2 allocate-ipam-pool-cidr --ipam-pool-id "$IPAM_POOL_ID" --netmask-length 25 --description 'troubleshoot' | jq -c -r '.IpamPoolAllocation.IpamPoolAllocationId')"
aws ec2 get-ipam-pool-allocations \
--ipam-pool-id "$IPAM_POOL_ID" \
--ipam-pool-allocation-id "$ALLOCATION_ID" \
--no-cli-pager |
Interesting. For me the script always runs through without any issues and the creation through terraform still throws the error InvalidIpamPoolAllocationId.NotFound. Exact same IAM-Role used. Mili Durasovic mili.durasovic@mercedes-benz.com, Mercedes-Benz Tech Innovation GmbH |
@bebold-jhr can you please log a separate GitHub issue as a bug regarding the your |
@AdamTylerLynch I will do that. I just thought it was worth mentioning that using import was not a workaround for us. |
Appears to be related to #25300 |
Got confirmation from IPAM service team via AWS Enterprise support that:
I guess we need #25300 to be resolved then 😄 |
A quick clarification, AWS Enterprise Support does offer Third-Party Product support, including open source software such as Terraform. I agree that having a reproducible case in a script using the AWS CLI is certainly helpful, though not required. AWS works with Hashicorp and the open source community to evaluate and prioritize issues as per the Terraform AWS Provider FAQ. |
Further testing yielded the following results:
The first run of the code fails for some of the resources. Multiple iterations of this code will result in progressively more successful resources being created. It usually takes between 3 and 6 consecutive attempts to fully create all six resources.
The execution of this script just ran fine and resulted in no errors at all. From my point of view this could be a timing problem in the resourceIPAMPoolCIDRAllocationCreate function. It seems that the resource is already being read before the creation is fully completed. Jonas Wieneke <jonas.wieneke@mercedes-benz.com>, Mercedes-Benz Tech Innovation GmbH |
I can successfully reproduce in an AccTests. Working on a fix. |
I also just started on this issue and added this code block to
We need this change urgently. Do you work on this within the next few days or should I open a PR? If the latter, could you share your test code? |
Hello Kevin, thanks for putting the effort in for the sample code! In the provider we have mechanisms for retries and waiting (retries and waiters), and our PR guidelines suggest that we follow any exiting patterns in the resource being modified. I have added the mechanisms for retry and waiting to account for eventually consistency of the read operation, and I've added additional acceptance tests to verify cross region pool CIDR allocation. I assure you this is being worked on. The provider team does releases each Thursday. |
This functionality has been released in v4.52.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! |
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. |
Terraform Core Version
1.3.2
AWS Provider Version
4.32.0 and 4.50.0
Affected Resource(s)
aws_vpc_ipam_pool_cidr_allocation
Expected Behavior
I expected that the IPAM allocation will be created successfully.
Actual Behavior
In our environment we are using a multi-account setup. The IPAM pools are created in one account and shared with RAM to another account. We are running in the below mentioned issue when we want to allocate an CIDR in the shared IPAM pool.
To create our IPAM pool allocation we are using this snippet in our code:
But immediately afterwards we get the following error:
When we run "aws ec2 get-ipam-pool-allocations --ipam-pool-id ipam-pool-0b325bb4efc6dacae", I properly get returned all IpamPoolAllocations.
aws_vpc_ipam_pool_cidr_allocation
in a different AWS account and ran also into that issue.aws_vpc_ipam_pool_cidr_allocation
without throwing the error.Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
Debug Output
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None
Alexander Barth (alexander.barth@mercedes-benz.com) on behalf of Mercedes-Benz Tech Innovation GmbH, Provider Information
The text was updated successfully, but these errors were encountered: