Skip to content

Commit 99bc470

Browse files
committed
multi-arch-builders/tofu: introduce new toplevel project var
Now we can use `var.project` throughout rather than copy pasting the name around. Also shorten `coreos-multiarch-builder-aarch64` here to just `coreos-aarch64-builder`
1 parent 7b7cbe7 commit 99bc470

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

multi-arch-builders/provisioning/aarch64/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ Make sure your AMI user has access to this policies:
4444
# If you plan to make changes to the code as modules/plugins, go ahead and run it:
4545
tofu init -upgrade
4646
# To destroy it run:
47-
tofu destroy -target aws_instance.coreos-multiarch-builder-aarch64
47+
tofu destroy -target aws_instance.coreos-aarch64-builder
4848
```

multi-arch-builders/provisioning/aarch64/main.tf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ provider "aws" {}
1919
provider "ct" {}
2020
provider "http" {}
2121

22+
variable "project" {
23+
type = string
24+
default = "coreos-aarch64-builder"
25+
}
26+
27+
2228
# Get ignition created for the multiarch builder
2329
resource "null_resource" "butane" {
2430
provisioner "local-exec" {
@@ -41,9 +47,9 @@ locals {
4147
ami = lookup(jsondecode(data.http.stream_metadata.body).architectures.aarch64.images.aws.regions, data.aws_region.aws_region.name).image
4248
}
4349

44-
resource "aws_instance" "coreos-multiarch-builder-aarch64" {
50+
resource "aws_instance" "coreos-aarch64-builder" {
4551
tags = {
46-
Name = "coreos-aarch64-builder-${formatdate("YYYYMMDD", timestamp())}"
52+
Name = "${var.project}-${formatdate("YYYYMMDD", timestamp())}"
4753
}
4854
ami = local.ami
4955
user_data = file("coreos-aarch64-builder.ign")
@@ -57,5 +63,5 @@ resource "aws_instance" "coreos-multiarch-builder-aarch64" {
5763
}
5864

5965
output "instance_ip_addr" {
60-
value = aws_instance.coreos-multiarch-builder-aarch64.private_ip
66+
value = aws_instance.coreos-aarch64-builder.private_ip
6167
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "aws_security_group" "sg" {
2-
name = "coreos-multiarch-aarch64-security-group"
2+
name = "${var.project}-security-group"
33
description = "Allow SSH inbound traffic only"
44
vpc_id = var.aws_vpc_prod
55

@@ -10,15 +10,15 @@ resource "aws_security_group" "sg" {
1010
protocol = "tcp"
1111
cidr_blocks = ["0.0.0.0/0"]
1212
}
13-
13+
1414
egress {
1515
from_port = 0
1616
to_port = 0
1717
protocol = "-1"
1818
cidr_blocks = ["0.0.0.0/0"]
1919
}
20-
20+
2121
tags = {
22-
Name = "coreos-multiarch-aarch64-security-group"
22+
Name = "${var.project}-security-group"
2323
}
2424
}

0 commit comments

Comments
 (0)