Hi All,
I am new to Terraform, wanted to provision an aws instance, its available in AWS-Marketplace. I have gone througth the documents and got solution to pick the instance image based on its ami-id. But I dont have any ami-id in my image. I wanted to pick with the name. The image is "CIS Ubuntu Linux 18.04 LTS Benchmark - Level 1"
I configured my resources.tf
data “aws_ami” “cisubuntu” {
owners = [“xxxxxxxx”]
filter {
name = "name"
values = ["CIS Ubuntu Linux 18.04 LTS Benchmark - Level 1"]
}
}
resource “aws_instance” “cis-instance” {
ami= “${data.aws_ami.cisubuntu.id}”
instance_type = “t2.micro”
key_name = “mykeyfile”
tags= {
Name = “cis-instance”
}
}
But when I do terraform apply, its throwing the below error:
Error: Your query returned no results. Please change your search criteria and try again.
on aws_ami.tf line 1, in data “aws_ami” “cisubuntu”:
1: data “aws_ami” “cisubuntu” {
Someone help me to configure the same with mentioned AMI.
Thanks,
Dhamodharan.