I tried out the creation of EC2 Instances using aws_launch_template{}
and aws_instance{}
resources , but after doing that, the detailed monitoring does not activate and for some reason I get such result:
My launch template and EC2 Instance resource look like this:
<code>resource "aws_launch_template" "name_lauch_template" {
name = "main-launch-template"
image_id = "ami-0314c062c813a4aa0"
update_default_version = true
instance_type = "t3.medium"
ebs_optimized = false
key_name = aws_key_pair.main.key_name
monitoring {
enabled = true
}
hibernation_options {
configured = false
}
network_interfaces {
associate_public_ip_address = true
security_groups = [ "${aws_security_group.main_sg.id}" ]
}
}
resource "aws_instance" "main_instances" {
count = 5
availability_zone = "eu-west-3a"
launch_template {
id = aws_launch_template.name_lauch_template.id
}
}
</code>
<code>resource "aws_launch_template" "name_lauch_template" {
name = "main-launch-template"
image_id = "ami-0314c062c813a4aa0"
update_default_version = true
instance_type = "t3.medium"
ebs_optimized = false
key_name = aws_key_pair.main.key_name
monitoring {
enabled = true
}
hibernation_options {
configured = false
}
network_interfaces {
associate_public_ip_address = true
security_groups = [ "${aws_security_group.main_sg.id}" ]
}
}
resource "aws_instance" "main_instances" {
count = 5
availability_zone = "eu-west-3a"
launch_template {
id = aws_launch_template.name_lauch_template.id
}
}
</code>
resource "aws_launch_template" "name_lauch_template" {
name = "main-launch-template"
image_id = "ami-0314c062c813a4aa0"
update_default_version = true
instance_type = "t3.medium"
ebs_optimized = false
key_name = aws_key_pair.main.key_name
monitoring {
enabled = true
}
hibernation_options {
configured = false
}
network_interfaces {
associate_public_ip_address = true
security_groups = [ "${aws_security_group.main_sg.id}" ]
}
}
resource "aws_instance" "main_instances" {
count = 5
availability_zone = "eu-west-3a"
launch_template {
id = aws_launch_template.name_lauch_template.id
}
}
I have monitoring{} block defined and have monitoring enabled so why is it writing that it is disabled ? Has anyone else encountered this problem and know the solution ?
Please verify if you are using the latest AWS terraform provider version. Monitoring has been available since v0.6.0…