File tree Expand file tree Collapse file tree 1 file changed +6
-19
lines changed Expand file tree Collapse file tree 1 file changed +6
-19
lines changed Original file line number Diff line number Diff line change @@ -5,33 +5,16 @@ locals {
5
5
}
6
6
}
7
7
8
- data "aws_ami" "ubuntu2204" {
9
- most_recent = true
10
- owners = [" 099720109477" ] # Canonical
11
- filter {
12
- name = " architecture"
13
- values = [" arm64" ]
14
- }
15
- filter {
16
- name = " virtualization-type"
17
- values = [" hvm" ]
18
- }
19
- filter {
20
- name = " name"
21
- values = [" ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-arm64-server-*" ]
22
- }
23
- }
24
-
25
8
resource "aws_launch_template" "launch_template" {
26
9
name_prefix = " DatadogAgentlessScannerLaunchTemplate"
27
- image_id = data . aws_ami . ubuntu2204 . id
10
+ image_id = " resolve:ssm:/aws/service/canonical/ubuntu/server/22.04/stable/current/arm64/hvm/ebs-gp2/ami-id "
28
11
instance_type = var. instance_type
29
12
user_data = base64encode (var. user_data )
30
13
vpc_security_group_ids = var. vpc_security_group_ids
31
14
key_name = var. key_name
32
15
33
16
block_device_mappings {
34
- device_name = data . aws_ami . ubuntu2204 . root_device_name
17
+ device_name = " /dev/sda1 "
35
18
ebs {
36
19
delete_on_termination = true
37
20
encrypted = true
@@ -82,6 +65,10 @@ resource "aws_autoscaling_group" "asg" {
82
65
version = aws_launch_template. launch_template . latest_version
83
66
}
84
67
68
+ # Instances are terminated every 24 hours and recreated with latest AMI.
69
+ # This allows automated upgrade of our instances baseline.
70
+ max_instance_lifetime = 24 * 3600
71
+
85
72
instance_refresh {
86
73
strategy = " Rolling"
87
74
preferences {
You can’t perform that action at this time.
0 commit comments