I am using terraform to get a list of AMI for a specific OS - ubuntu 20.04,
I have checked different examples link
When I use the script this does not give me list of AMI. So i modified the code
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["099720109477"]
}
However, ideally this should give me the details of ami in the region specified in my case us-east-1.
[ec2-user@ip-172-31-84-148 ~]$ terraform plan
provider.aws.region
The region where AWS operations will take place. Examples
are us-east-1, us-west-2, etc.Enter a value: us-east-1
Refreshing Terraform state in-memory prior to plan…
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.data.aws_ami.ubuntu: Refreshing state…
No changes. Infrastructure is up-to-date.
This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed.
and also i am not sure how create an out for the above script. KIndly i am not very good in terraform. Please guide me where am i going wrong.