-
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
Resource aws_ami doesn't support import #4907
Comments
Why would you want to import an AMI for Terraform to manage? If you want to be able to refer to an AMI you should be able to use the The data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["099720109477"] # Canonical
}
resource "aws_instance" "web" {
ami = "${data.aws_ami.ubuntu.id}"
instance_type = "t2.micro"
tags {
Name = "HelloWorld"
}
} |
@tomelliff, thanks for getting back to me. I am using Packer to generate AMIs, which means that they stay unmanaged. I would have liked to import them via Terraform so that they could be appropriately destroyed/recreated as needed, and for that reason using a data source doesn't help. I hope that makes sense. Thank you! |
I have the same exact need, as in I want to import my own image. Right now I convert them using aws ec2 import-image. |
Pull request submitted: #5990 |
So if my understanding is correct, this pull request would solve the initial problem but wouldn't solve the step of creating an AMI from a disk image contained in a S3 bucket, right? |
@mchouque you are correct. Could you submit a new, separate feature request issue with details about your use case and potential configuration? I bet a fresh issue would garner more attention than this existing issue since it might be slightly confusing with both Terraform and EC2 have differing meanings for "import". 😄 |
@mchouque great write up! 💯 |
This has been released in version 1.38.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
Community Note
Description
The AWS provider currently doesn't support importing
aws_ami
resources.New or Affected Resource(s)
v0.11.7
, provider.awsv1.24.0
)The text was updated successfully, but these errors were encountered: