-
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]: Import for aws_vpc_ipam_pool_cidr_allocation had no effect #28955
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
@bebold-jhr this issue was automatically closed because of the doc fix for the import instructions being merged. Beyond that, though, I was unable to replicate your issue. Here's my Terraform code: terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "= 4.50.0"
}
}
}
provider "aws" {
region = "eu-west-2"
}
data "aws_region" "current" {}
resource "aws_vpc_ipam" "test" {
operating_regions {
region_name = data.aws_region.current.name
}
}
resource "aws_vpc_ipam_pool" "test" {
address_family = "ipv4"
ipam_scope_id = aws_vpc_ipam.test.private_default_scope_id
locale = data.aws_region.current.name
}
resource "aws_vpc_ipam_pool_cidr" "test" {
ipam_pool_id = aws_vpc_ipam_pool.test.id
cidr = "172.2.0.0/24"
}
resource "aws_vpc_ipam_pool_cidr_allocation" "test" {
ipam_pool_id = aws_vpc_ipam_pool.test.id
cidr = cidrsubnet(aws_vpc_ipam_pool_cidr.test.cidr, 4, 0)
} And here's my reproducer script: #!/bin/sh
terraform apply -auto-approve
pool_alloc_id=$(terraform state show aws_vpc_ipam_pool_cidr_allocation.test | awk '$3 ~ /ipam-pool-alloc-.*ipam-pool-/ { gsub(/"/, "", $3); print $3 }')
terraform state show aws_vpc_ipam_pool_cidr_allocation.test
terraform state rm aws_vpc_ipam_pool_cidr_allocation.test
terraform import aws_vpc_ipam_pool_cidr_allocation.test ${pool_alloc_id}
terraform plan Here's the output showing that the
|
This functionality has been released in v4.51.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.7
AWS Provider Version
4.46.0
Affected Resource(s)
Expected Behavior
During creation of the resource we encountered an error. However the resource had been created in AWS, but was shown as tainted in the plan. What we wanted to do was re-import the resource.
So we first removed the tainted resource:
terraform state rm module.####.aws_vpc_ipam_pool_cidr_allocation.this
Then we wanted to import the resource via:
terraform import module.####.aws_vpc_ipam_pool_cidr_allocation.this ipam-pool-alloc-####_ipam-pool-####
Afterwards the resource should've been part of the terraform state without any changes in the plan.
Actual Behavior
The documentation says
However the example doesn't show the usage of the allocation id. Which might be incorrect in the documentation.
We then tried to import the resource using
terraform import module.####.aws_vpc_ipam_pool_cidr_allocation.this ipam-pool-alloc-####_ipam-pool-####
Import was allegedly successful, but nothing had happened. The resource was presented as a completely new resource in the next plan.
So is the import not working? Was our assumption to add the id in the import command incorrect? Is the example not correct?
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
Error: reading IPAM Pool CIDR Allocation (ipam-pool-alloc-xxxxxxxxxxx_ipam-pool-xxxxxxxxxx): couldn't find resource
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
#28913
Would you like to implement a fix?
No
The text was updated successfully, but these errors were encountered: