Skip to content

Commit 941ea44

Browse files
committed
Add instance name variable
1 parent ae37dff commit 941ea44

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ terraform.rc
3838
.env
3939
.envrc
4040
.DS_Store
41+
.vscode

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ resource "aws_instance" "gateway_ec2" {
5353
instance_type = var.instance_type
5454
subnet_id = data.aws_subnet.subnet.id
5555
vpc_security_group_ids = [aws_security_group.sg.id]
56-
user_data = base64encode(local.user_data)
56+
user_data = base64encode(local.user_data)
5757
tags = merge(local.default_tags, {
58-
Name = "sdm-gw-01"
58+
Name = var.gateway_instance_name
5959
})
6060

6161
metadata_options {

outputs.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,10 @@ output "ec2_instance_public_ip" {
2626
output "ec2_instance_public_dns" {
2727
description = "EC2 instance public DNS"
2828
value = aws_instance.gateway_ec2.public_dns
29+
}
30+
31+
output "gateway_instance_name" {
32+
description = "Name of the StrongDM gateway instance"
33+
value = aws_instance.gateway_ec2.tags["Name"]
34+
2935
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ variable "instance_type" {
4444
default = "t3.medium"
4545
}
4646

47+
variable "gateway_instance_name" {
48+
description = "The name of the gateway instance"
49+
type = string
50+
default = "sdm-gw-01"
51+
}
52+
4753
variable "SDM_ADMIN_TOKEN" {
4854
description = "The StrongDM admin token"
4955
type = string

0 commit comments

Comments
 (0)