Skip to content

Commit 9c0f7e6

Browse files
authored
Merge pull request #3 from hazelops/feature/set-permanent-ami
Set up permanent ami id to "ami-022d4249382309a48" (CORE-228)
2 parents 7bd2674 + a2c2c75 commit 9c0f7e6

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

data.tf

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ data "aws_ami" "ubuntu_20_04" {
1414
most_recent = true
1515
filter {
1616
name = "name"
17-
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
17+
# Ubuntu 20.04 LTS amd64 image in us-east-1. If upgrade is needed, you would need to re-connect to openvpn.
18+
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20211118"]
19+
1820
}
1921
filter {
2022
name = "virtualization-type"

main.tf

+8-9
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,30 @@ resource "aws_security_group" "this" {
2525
Env = var.env
2626
Name = local.name
2727
}
28-
28+
2929
lifecycle {
3030
create_before_destroy = true
3131
}
3232
}
3333

3434
# EC2
3535
resource "aws_instance" "this" {
36-
ami = join("", data.aws_ami.ubuntu_20_04.*.id)
37-
instance_type = var.instance_type
38-
iam_instance_profile = aws_iam_instance_profile.this.name
39-
subnet_id = var.private_subnets[0]
40-
key_name = var.ec2_key_pair_name
36+
ami = join("", data.aws_ami.ubuntu_20_04.*.id)
37+
instance_type = var.instance_type
38+
iam_instance_profile = aws_iam_instance_profile.this.name
39+
subnet_id = var.private_subnets[0]
40+
key_name = var.ec2_key_pair_name
4141
vpc_security_group_ids = concat(var.ext_security_groups, [
4242
aws_security_group.this.id
4343
])
44-
45-
disable_api_termination = var.vpn_enabled ? true : false
44+
4645
associate_public_ip_address = false
4746

4847
lifecycle {
4948
ignore_changes = all
5049
}
5150

52-
user_data = var.vpn_enabled ? data.template_file.ec2_user_data.rendered : null
51+
user_data = var.vpn_enabled ? data.template_file.ec2_user_data.rendered : null
5352

5453
tags = {
5554
Terraform = "true"

0 commit comments

Comments
 (0)