Skip to content

Commit 4d43c60

Browse files
authored
Merge pull request #133 from jdno/fix-dev-desktops
Fix Terraform configuration for dev desktops
2 parents b7d016e + 2e4dc00 commit 4d43c60

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

terraform/dev-desktops/.terraform.lock.hcl

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

terraform/dev-desktops/aws-region/_terraform.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ terraform {
1010
variable "instances" {
1111
type = map(object({
1212
instance_type = string
13+
instance_arch = string
1314
storage = number
1415
}))
1516
}

terraform/dev-desktops/aws-region/instances.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
resource "aws_instance" "instance" {
44
for_each = var.instances
55

6-
ami = data.aws_ami.instance.id
6+
ami = data.aws_ami.instance[each.value.instance_arch].id
77
instance_type = each.value.instance_type
88
key_name = aws_key_pair.instance.key_name
99
ebs_optimized = true
@@ -32,12 +32,14 @@ resource "aws_instance" "instance" {
3232
}
3333

3434
data "aws_ami" "instance" {
35+
for_each = toset(values(var.instances)[*].instance_arch)
36+
3537
most_recent = true
3638
owners = ["099720109477"] # Canonical
3739

3840
filter {
3941
name = "name"
40-
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
42+
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-${each.key}-server-*"]
4143
}
4244

4345
filter {

terraform/dev-desktops/regions.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ module "aws_eu_central_1" {
77
instances = {
88
"dev-desktop-staging" = {
99
instance_type = "t3a.micro"
10+
instance_arch = "amd64"
1011
storage = 25
1112
}
1213
"dev-desktop-eu-1" = {
13-
instance_type = "c7g.8xlarge"
14+
instance_type = "c6g.8xlarge"
15+
instance_arch = "arm64"
1416
storage = 1000
1517
}
1618
}
@@ -25,6 +27,7 @@ module "aws_us_east_1" {
2527
instances = {
2628
"dev-desktop-us-1" = {
2729
instance_type = "c7g.8xlarge"
30+
instance_arch = "arm64"
2831
storage = 1000
2932
}
3033
}

0 commit comments

Comments
 (0)