Skip to content

Commit

Permalink
- Update name to contain var.name
Browse files Browse the repository at this point in the history
- Add variables descriptions
- Update README.md
  • Loading branch information
AutomationD committed Aug 4, 2024
1 parent 5e325bc commit ae18826
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Local PC:
```
module "bastion" {
source = "hazelops/ec2-bastion/aws"
version = "~> 2.0"
version = "~> 3.0"
aws_profile = var.aws_profile
aws_profile = var.aws_profile
env = var.env
vpc_id = local.vpc_id
private_subnets = local.private_subnets
Expand Down
5 changes: 2 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# TODO: install Fail2ban
resource "aws_security_group" "this" {
name = "${var.env}-bastion"
vpc_id = var.vpc_id

ingress {
Expand All @@ -18,7 +17,7 @@ resource "aws_security_group" "this" {
}

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

Expand All @@ -34,6 +33,6 @@ resource "aws_instance" "this" {
subnet_id = var.private_subnets[0]
associate_public_ip_address = false
tags = merge({
Name = "${var.env}-bastion"
Name = "${var.env}-${var.name}"
}, var.tags)
}
30 changes: 25 additions & 5 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
variable "env" {}
variable "aws_profile" {}
variable "vpc_id" {}
variable "private_subnets" {}
variable "ec2_key_pair_name" {}
variable "env" {
type = string
description = "Environment name, for example `dev`"
}

variable "aws_profile" {
type = string
description = "AWS Profile to use during tunnel creation"
}

variable "vpc_id" {
type = string
description = "VPC ID"
}

variable "private_subnets" {
type = list(string)
description = "Private subnets"
}

variable "ec2_key_pair_name" {
type = string
description = "EC2 Key Pair Name"
}

variable "instance_type" {
type = string
description = "EC2 instance type for bastion host"
default = "t3.nano"
}

Expand Down

0 comments on commit ae18826

Please sign in to comment.