Add missing instance monitoring for CF and TF

This commit is contained in:
Ciprian Hacman 2020-11-04 06:47:57 +02:00
parent 51e70083f8
commit b5e4b7ad48
7 changed files with 31 additions and 0 deletions

View File

@ -395,6 +395,9 @@
},
"ImageId": "ami-12345678",
"InstanceType": "t2.medium",
"Monitoring": {
"Enabled": true
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,

View File

@ -371,6 +371,9 @@ resource "aws_launch_template" "nodes-complex-example-com" {
lifecycle {
create_before_destroy = true
}
monitoring {
enabled = true
}
name_prefix = "nodes.complex.example.com-"
network_interfaces {
associate_public_ip_address = true

View File

@ -411,6 +411,9 @@ resource "aws_launch_template" "nodes-externalpolicies-example-com" {
lifecycle {
create_before_destroy = true
}
monitoring {
enabled = true
}
name_prefix = "nodes.externalpolicies.example.com-"
network_interfaces {
associate_public_ip_address = true

View File

@ -206,6 +206,11 @@ func (t *LaunchTemplate) RenderCloudformation(target *cloudformation.Cloudformat
if e.Tenancy != nil {
data.Placement = []*cloudformationLaunchTemplatePlacement{{Tenancy: e.Tenancy}}
}
if e.InstanceMonitoring != nil {
data.Monitoring = &cloudformationLaunchTemplateMonitoring{
Enabled: e.InstanceMonitoring,
}
}
if e.IAMInstanceProfile != nil {
data.IAMInstanceProfile = &cloudformationLaunchTemplateIAMProfile{
Name: e.IAMInstanceProfile.CloudformationLink(),

View File

@ -72,6 +72,9 @@ func TestLaunchTemplateCloudformationRender(t *testing.T) {
"MaxPrice": "10"
}
},
"Monitoring": {
"Enabled": true
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,
@ -155,6 +158,9 @@ func TestLaunchTemplateCloudformationRender(t *testing.T) {
},
"InstanceType": "t2.medium",
"KeyName": "mykey",
"Monitoring": {
"Enabled": true
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,

View File

@ -205,6 +205,11 @@ func (t *LaunchTemplate) RenderTerraform(target *terraform.TerraformTarget, a, e
if e.Tenancy != nil {
tf.Placement = []*terraformLaunchTemplatePlacement{{Tenancy: e.Tenancy}}
}
if e.InstanceMonitoring != nil {
tf.Monitoring = []*terraformLaunchTemplateMonitoring{
{Enabled: e.InstanceMonitoring},
}
}
if e.IAMInstanceProfile != nil {
tf.IAMInstanceProfile = []*terraformLaunchTemplateIAMProfile{
{Name: e.IAMInstanceProfile.TerraformLink()},

View File

@ -72,6 +72,9 @@ resource "aws_launch_template" "test" {
lifecycle {
create_before_destroy = true
}
monitoring {
enabled = true
}
name_prefix = "test-"
network_interfaces {
associate_public_ip_address = true
@ -148,6 +151,9 @@ resource "aws_launch_template" "test" {
lifecycle {
create_before_destroy = true
}
monitoring {
enabled = true
}
name_prefix = "test-"
network_interfaces {
associate_public_ip_address = true