on test.tf line 14, in resource “aws_instance” “test”:
14: root_block_device = {
An argument named “root_block_device” is not expected here. Did you mean to
define a block of type “root_block_device”?
…
resource “aws_instance” “test” {
ami = “JMdkQ5aOmNIzzceMwHhNZ0SX15b+2uslQX3cZ9qt”
instance_type = “t2.micro”
key_name = “sar-test”
availability_zone = “ap-south-1c”
security_groups = “{aws_security_group.allow_SSH.id}"
subnet_id = "subnet-7738e40c"
root_block_device = {
volume_size = 10,
delete_on_termination = true,
encrypted = true,
device_name = "/dev/sda1"
}
#"{root_block_device.HD1.id}”
}
resource “aws_security_group” “allow_SSH” {
ingress {
from_port = 22
to_port = 22
protocol = “-1”
cidr_blocks = [“0.0.0.0/0”]
}
ingress {
from_port = 80
to_port = 80
protocol = “-1”
cidr_blocks = [“0.0.0.0/0”]
}
}
#resource “aws_root_block_device” “HD1” {
volume_size = “10”
delete_on_termination = “true”
encrypted = “true”
device_name = “/dev/sda1”
#}
Im trying to provision a AWS Ec2 instance this is the basic code im gonna use, there is a error.
Kindly Someone help…
Kindly Go through the complete code and help me with the corrections.
Thanks in Advance