Skip to content

Commit edddecb

Browse files
committed
Add CreatedBy tag to see who created instances
Also switch yum to dnf
1 parent 969615c commit edddecb

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

environment/aws/lb_setup/configure-system.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -x
44

55
if ! command -v docker &> /dev/null; then
6-
sudo yum install -y docker
6+
sudo dnf install -y docker
77
sudo systemctl start docker
88
fi
99

environment/aws/logslurp_setup/configure-system.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -x
44

55
if ! command -v docker &> /dev/null; then
6-
sudo yum install -y docker
6+
sudo dnf install -y docker
77
sudo systemctl start docker
88
fi
99

environment/aws/main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ provider "aws" {
1313
region = "us-east-1"
1414
}
1515

16+
# Who is running Terraform
17+
data "aws_caller_identity" "current" {}
18+
1619
# Read the subnet in which to insert our EC2 instances.
1720
# The mobile-e2e subnet exists in the mobile-e2e VPC and
1821
# has domain over the IP addresses 10.0.1.1 - 10.0.1.255
@@ -56,6 +59,7 @@ resource "aws_instance" "couchbaseserver" {
5659
Name = "cbs"
5760
Type = "couchbaseserver"
5861
ExpireAt = local.expire_at
62+
CreatedBy = local.created_by
5963
}
6064

6165
lifecycle {
@@ -83,6 +87,7 @@ resource "aws_instance" "sync_gateway" {
8387
Name = "sg"
8488
Type = "syncgateway"
8589
ExpireAt = local.expire_at
90+
CreatedBy = local.created_by
8691
}
8792

8893
lifecycle {
@@ -105,6 +110,7 @@ resource "aws_instance" "edge_server" {
105110
Name = "es"
106111
Type = "edgeserver"
107112
ExpireAt = local.expire_at
113+
CreatedBy = local.created_by
108114
}
109115

110116
lifecycle {
@@ -127,6 +133,7 @@ resource "aws_instance" "load_balancer" {
127133
Name = "lb"
128134
Type = "loadbalancer"
129135
ExpireAt = local.expire_at
136+
CreatedBy = local.created_by
130137
}
131138

132139
lifecycle {
@@ -157,6 +164,8 @@ resource "aws_instance" "log_slurp" {
157164
}
158165

159166
locals {
167+
arn_path_parts = split("/", data.aws_caller_identity.current.arn)
168+
created_by = local.arn_path_parts[length(local.arn_path_parts)-1]
160169
expire_at = formatdate(
161170
"YYYY-MM-DD'T'hh:mm:ss'Z'",
162171
timeadd(timestamp(), format("%dh", 3 * 24))

environment/aws/server_setup/configure-system.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -x
44

55
if ! command -v docker &> /dev/null; then
66
echo "Docker not found, installing and starting..."
7-
sudo yum install -y docker
7+
sudo dnf install -y docker
88
sudo systemctl start docker
99
fi
1010

0 commit comments

Comments
 (0)