Skip to content

Commit

Permalink
Add external tags, cleanup tags, lint
Browse files Browse the repository at this point in the history
  • Loading branch information
AutomationD committed Jun 26, 2024
1 parent 7fb025a commit b728fbc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
25 changes: 10 additions & 15 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,23 @@ resource "aws_security_group" "this" {
cidr_blocks = var.allowed_cidr_blocks
}

tags = {
Terraform = "true"
Env = var.env
Name = "${var.env}-bastion"
}
tags = merge({
name = "${var.env}-bastion"
}, var.tags)
}

# TODO: This needs to become an autoscale of one instance
resource "aws_instance" "this" {
ami = data.aws_ami.this.id
key_name = var.ec2_key_pair_name
instance_type = var.instance_type
iam_instance_profile = aws_iam_instance_profile.this.name
ami = data.aws_ami.this.id
key_name = var.ec2_key_pair_name
instance_type = var.instance_type
iam_instance_profile = aws_iam_instance_profile.this.name
vpc_security_group_ids = concat(var.ext_security_groups, [
aws_security_group.this.id
])
subnet_id = var.private_subnets[0]
associate_public_ip_address = false

tags = {
Terraform = "true"
Env = var.env
Name = local.name
}
tags = merge({
name = "${var.env}-bastion"
}, var.tags)
}
8 changes: 7 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ variable "ssm_role" {
default = "arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM"
}

variable "tags" {
type = map(string)
description = "Additional tags for the resources"
default = {}
}

variable "ssh_forward_rules" {
type = list(string)
description = "Rules that will enable port forwarding. SSH Config syntax"
Expand All @@ -40,7 +46,7 @@ locals {
proxycommand = <<-EOT
ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
EOT
ssh_config = concat([
ssh_config = concat([
"# SSH over Session Manager",
"host i-* mi-*",
"ServerAliveInterval 180",
Expand Down

0 comments on commit b728fbc

Please sign in to comment.