diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl
new file mode 100644
index 000000000..038146ce8
--- /dev/null
+++ b/.terraform.lock.hcl
@@ -0,0 +1,59 @@
+# This file is maintained automatically by "terraform init".
+# Manual edits may be lost in future updates.
+
+provider "registry.terraform.io/hashicorp/aws" {
+ version = "3.42.0"
+ constraints = "3.42.0"
+ hashes = [
+ "h1:quV6hK7ewiHWBznGWCb/gJ6JAPm6UtouBUrhAjv6oRY=",
+ "zh:126c856a6eedddd8571f161a826a407ba5655a37a6241393560a96b8c4beca1a",
+ "zh:1a4868e6ac734b5fc2e79a4a889d176286b66664aad709435aa6acee5871d5b0",
+ "zh:40fed7637ab8ddeb93bef06aded35d970f0628025b97459ae805463e8aa0a58a",
+ "zh:68def3c0a5a1aac1db6372c51daef858b707f03052626d3427ac24cba6f2014d",
+ "zh:6db7ec9c8d1803a0b6f40a664aa892e0f8894562de83061fa7ac1bc51ff5e7e5",
+ "zh:7058abaad595930b3f97dc04e45c112b2dbf37d098372a849081f7081da2fb52",
+ "zh:8c25adb15a19da301c478aa1f4a4d8647cabdf8e5dae8331d4490f80ea718c26",
+ "zh:8e129b847401e39fcbc54817726dab877f36b7f00ff5ed76f7b43470abe99ff9",
+ "zh:d268bb267a2d6b39df7ddee8efa7c1ef7a15cf335dfa5f2e64c9dae9b623a1b8",
+ "zh:d6eeb3614a0ab50f8e9ab5666ae5754ea668ce327310e5b21b7f04a18d7611a8",
+ "zh:f5d3c58055dff6e38562b75d3edc908cb2f1e45c6914f6b00f4773359ce49324",
+ ]
+}
+
+provider "registry.terraform.io/hashicorp/null" {
+ version = "3.2.1"
+ hashes = [
+ "h1:FbGfc+muBsC17Ohy5g806iuI1hQc4SIexpYCrQHQd8w=",
+ "zh:58ed64389620cc7b82f01332e27723856422820cfd302e304b5f6c3436fb9840",
+ "zh:62a5cc82c3b2ddef7ef3a6f2fedb7b9b3deff4ab7b414938b08e51d6e8be87cb",
+ "zh:63cff4de03af983175a7e37e52d4bd89d990be256b16b5c7f919aff5ad485aa5",
+ "zh:74cb22c6700e48486b7cabefa10b33b801dfcab56f1a6ac9b6624531f3d36ea3",
+ "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
+ "zh:79e553aff77f1cfa9012a2218b8238dd672ea5e1b2924775ac9ac24d2a75c238",
+ "zh:a1e06ddda0b5ac48f7e7c7d59e1ab5a4073bbcf876c73c0299e4610ed53859dc",
+ "zh:c37a97090f1a82222925d45d84483b2aa702ef7ab66532af6cbcfb567818b970",
+ "zh:e4453fbebf90c53ca3323a92e7ca0f9961427d2f0ce0d2b65523cc04d5d999c2",
+ "zh:e80a746921946d8b6761e77305b752ad188da60688cfd2059322875d363be5f5",
+ "zh:fbdb892d9822ed0e4cb60f2fedbdbb556e4da0d88d3b942ae963ed6ff091e48f",
+ "zh:fca01a623d90d0cad0843102f9b8b9fe0d3ff8244593bd817f126582b52dd694",
+ ]
+}
+
+provider "registry.terraform.io/hashicorp/tls" {
+ version = "4.0.4"
+ hashes = [
+ "h1:pe9vq86dZZKCm+8k1RhzARwENslF3SXb9ErHbQfgjXU=",
+ "zh:23671ed83e1fcf79745534841e10291bbf34046b27d6e68a5d0aab77206f4a55",
+ "zh:45292421211ffd9e8e3eb3655677700e3c5047f71d8f7650d2ce30242335f848",
+ "zh:59fedb519f4433c0fdb1d58b27c210b27415fddd0cd73c5312530b4309c088be",
+ "zh:5a8eec2409a9ff7cd0758a9d818c74bcba92a240e6c5e54b99df68fff312bbd5",
+ "zh:5e6a4b39f3171f53292ab88058a59e64825f2b842760a4869e64dc1dc093d1fe",
+ "zh:810547d0bf9311d21c81cc306126d3547e7bd3f194fc295836acf164b9f8424e",
+ "zh:824a5f3617624243bed0259d7dd37d76017097dc3193dac669be342b90b2ab48",
+ "zh:9361ccc7048be5dcbc2fafe2d8216939765b3160bd52734f7a9fd917a39ecbd8",
+ "zh:aa02ea625aaf672e649296bce7580f62d724268189fe9ad7c1b36bb0fa12fa60",
+ "zh:c71b4cd40d6ec7815dfeefd57d88bc592c0c42f5e5858dcc88245d371b4b8b1e",
+ "zh:dabcd52f36b43d250a3d71ad7abfa07b5622c69068d989e60b79b2bb4f220316",
+ "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
+ ]
+}
diff --git a/files/deploy_app.sh b/files/deploy_app.sh
index 1a1a7db07..344eb4dc6 100644
--- a/files/deploy_app.sh
+++ b/files/deploy_app.sh
@@ -11,7 +11,7 @@ cat << EOM > /var/www/html/index.html
Meow World!
- Welcome to ${PREFIX}'s app. Replace this text with your own.
+ Welcome to ${PREFIX}'s app. Muning
diff --git a/main.tf b/main.tf
index aa5ee2725..048184eee 100644
--- a/main.tf
+++ b/main.tf
@@ -1,199 +1,200 @@
-terraform {
- required_providers {
- aws = {
- source = "hashicorp/aws"
- version = "=3.42.0"
- }
- }
-}
-
-provider "aws" {
- region = var.region
-}
-
-resource "aws_vpc" "hashicat" {
- cidr_block = var.address_space
- enable_dns_hostnames = true
-
- tags = {
- name = "${var.prefix}-vpc-${var.region}"
- environment = "Production"
- }
-}
-
-resource "aws_subnet" "hashicat" {
- vpc_id = aws_vpc.hashicat.id
- cidr_block = var.subnet_prefix
-
- tags = {
- name = "${var.prefix}-subnet"
- }
-}
-
-resource "aws_security_group" "hashicat" {
- name = "${var.prefix}-security-group"
-
- vpc_id = aws_vpc.hashicat.id
-
- ingress {
- from_port = 22
- to_port = 22
- protocol = "tcp"
- cidr_blocks = ["0.0.0.0/0"]
- }
-
- ingress {
- from_port = 80
- to_port = 80
- protocol = "tcp"
- cidr_blocks = ["0.0.0.0/0"]
- }
-
- ingress {
- from_port = 443
- to_port = 443
- protocol = "tcp"
- cidr_blocks = ["0.0.0.0/0"]
- }
-
- egress {
- from_port = 0
- to_port = 0
- protocol = "-1"
- cidr_blocks = ["0.0.0.0/0"]
- prefix_list_ids = []
- }
-
- tags = {
- Name = "${var.prefix}-security-group"
- }
-}
-
-resource "aws_internet_gateway" "hashicat" {
- vpc_id = aws_vpc.hashicat.id
-
- tags = {
- Name = "${var.prefix}-internet-gateway"
- }
-}
-
-resource "aws_route_table" "hashicat" {
- vpc_id = aws_vpc.hashicat.id
-
- route {
- cidr_block = "0.0.0.0/0"
- gateway_id = aws_internet_gateway.hashicat.id
- }
-}
-
-resource "aws_route_table_association" "hashicat" {
- subnet_id = aws_subnet.hashicat.id
- route_table_id = aws_route_table.hashicat.id
-}
-
-data "aws_ami" "ubuntu" {
- most_recent = true
-
- filter {
- name = "name"
- #values = ["ubuntu/images/hvm-ssd/ubuntu-disco-19.04-amd64-server-*"]
- values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
- }
-
- filter {
- name = "virtualization-type"
- values = ["hvm"]
- }
-
- owners = ["099720109477"] # Canonical
-}
-
-resource "aws_eip" "hashicat" {
- instance = aws_instance.hashicat.id
- vpc = true
-}
-
-resource "aws_eip_association" "hashicat" {
- instance_id = aws_instance.hashicat.id
- allocation_id = aws_eip.hashicat.id
-}
-
-resource "aws_instance" "hashicat" {
- ami = data.aws_ami.ubuntu.id
- instance_type = var.instance_type
- key_name = aws_key_pair.hashicat.key_name
- associate_public_ip_address = true
- subnet_id = aws_subnet.hashicat.id
- vpc_security_group_ids = [aws_security_group.hashicat.id]
-
- tags = {
- Name = "${var.prefix}-hashicat-instance"
- }
-}
-
-# We're using a little trick here so we can run the provisioner without
-# destroying the VM. Do not do this in production.
-
-# If you need ongoing management (Day N) of your virtual machines a tool such
-# as Chef or Puppet is a better choice. These tools track the state of
-# individual files and can keep them in the correct configuration.
-
-# Here we do the following steps:
-# Sync everything in files/ to the remote VM.
-# Set up some environment variables for our script.
-# Add execute permissions to our scripts.
-# Run the deploy_app.sh script.
-resource "null_resource" "configure-cat-app" {
- depends_on = [aws_eip_association.hashicat]
-
- triggers = {
- build_number = timestamp()
- }
-
- provisioner "file" {
- source = "files/"
- destination = "/home/ubuntu/"
-
- connection {
- type = "ssh"
- user = "ubuntu"
- private_key = tls_private_key.hashicat.private_key_pem
- host = aws_eip.hashicat.public_ip
- }
- }
-
- provisioner "remote-exec" {
- inline = [
- "sudo apt -y update",
- "sleep 15",
- "sudo apt -y update",
- "sudo apt -y install apache2",
- "sudo systemctl start apache2",
- "sudo chown -R ubuntu:ubuntu /var/www/html",
- "chmod +x *.sh",
- "PLACEHOLDER=${var.placeholder} WIDTH=${var.width} HEIGHT=${var.height} PREFIX=${var.prefix} ./deploy_app.sh",
- "sudo apt -y install cowsay",
- "cowsay Mooooooooooo!",
- ]
-
- connection {
- type = "ssh"
- user = "ubuntu"
- private_key = tls_private_key.hashicat.private_key_pem
- host = aws_eip.hashicat.public_ip
- }
- }
-}
-
-resource "tls_private_key" "hashicat" {
- algorithm = "ED25519"
-}
-
-locals {
- private_key_filename = "${var.prefix}-ssh-key.pem"
-}
-
-resource "aws_key_pair" "hashicat" {
- key_name = local.private_key_filename
- public_key = tls_private_key.hashicat.public_key_openssh
-}
+terraform {
+ required_providers {
+ aws = {
+ source = "hashicorp/aws"
+ version = "=3.42.0"
+ }
+ }
+}
+
+provider "aws" {
+ region = var.region
+}
+
+resource "aws_vpc" "hashicat" {
+ cidr_block = var.address_space
+ enable_dns_hostnames = true
+
+ tags = {
+ name = "${var.prefix}-vpc-${var.region}"
+ environment = "Production"
+ }
+}
+
+resource "aws_subnet" "hashicat" {
+ vpc_id = aws_vpc.hashicat.id
+ cidr_block = var.subnet_prefix
+
+ tags = {
+ name = "${var.prefix}-subnet"
+ }
+}
+
+resource "aws_security_group" "hashicat" {
+ name = "${var.prefix}-security-group"
+
+ vpc_id = aws_vpc.hashicat.id
+
+ ingress {
+ from_port = 22
+ to_port = 22
+ protocol = "tcp"
+ cidr_blocks = ["0.0.0.0/0"]
+ }
+
+ ingress {
+ from_port = 80
+ to_port = 80
+ protocol = "tcp"
+ cidr_blocks = ["0.0.0.0/0"]
+ }
+
+ ingress {
+ from_port = 443
+ to_port = 443
+ protocol = "tcp"
+ cidr_blocks = ["0.0.0.0/0"]
+ }
+
+ egress {
+ from_port = 0
+ to_port = 0
+ protocol = "-1"
+ cidr_blocks = ["0.0.0.0/0"]
+ prefix_list_ids = []
+ }
+
+ tags = {
+ Name = "${var.prefix}-security-group"
+ }
+}
+
+resource "aws_internet_gateway" "hashicat" {
+ vpc_id = aws_vpc.hashicat.id
+
+ tags = {
+ Name = "${var.prefix}-internet-gateway"
+ }
+}
+
+resource "aws_route_table" "hashicat" {
+ vpc_id = aws_vpc.hashicat.id
+
+ route {
+ cidr_block = "0.0.0.0/0"
+ gateway_id = aws_internet_gateway.hashicat.id
+ }
+}
+
+resource "aws_route_table_association" "hashicat" {
+ subnet_id = aws_subnet.hashicat.id
+ route_table_id = aws_route_table.hashicat.id
+}
+
+data "aws_ami" "ubuntu" {
+ most_recent = true
+
+ filter {
+ name = "name"
+ #values = ["ubuntu/images/hvm-ssd/ubuntu-disco-19.04-amd64-server-*"]
+ values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
+ }
+
+ filter {
+ name = "virtualization-type"
+ values = ["hvm"]
+ }
+
+ owners = ["099720109477"] # Canonical
+}
+
+resource "aws_eip" "hashicat" {
+ instance = aws_instance.hashicat.id
+ vpc = true
+}
+
+resource "aws_eip_association" "hashicat" {
+ instance_id = aws_instance.hashicat.id
+ allocation_id = aws_eip.hashicat.id
+}
+
+resource "aws_instance" "hashicat" {
+ ami = data.aws_ami.ubuntu.id
+ instance_type = var.instance_type
+ key_name = aws_key_pair.hashicat.key_name
+ associate_public_ip_address = true
+ subnet_id = aws_subnet.hashicat.id
+
+ tags = {
+ Name = "${var.prefix}-hashicat-instance"
+ Department = "devops"
+ Billable = true
+ }
+}
+
+# We're using a little trick here so we can run the provisioner without
+# destroying the VM. Do not do this in production.
+
+# If you need ongoing management (Day N) of your virtual machines a tool such
+# as Chef or Puppet is a better choice. These tools track the state of
+# individual files and can keep them in the correct configuration.
+
+# Here we do the following steps:
+# Sync everything in files/ to the remote VM.
+# Set up some environment variables for our script.
+# Add execute permissions to our scripts.
+# Run the deploy_app.sh script.
+resource "null_resource" "configure-cat-app" {
+ depends_on = [aws_eip_association.hashicat]
+
+ triggers = {
+ build_number = timestamp()
+ }
+
+ provisioner "file" {
+ source = "files/"
+ destination = "/home/ubuntu/"
+
+ connection {
+ type = "ssh"
+ user = "ubuntu"
+ private_key = tls_private_key.hashicat.private_key_pem
+ host = aws_eip.hashicat.public_ip
+ }
+ }
+
+ provisioner "remote-exec" {
+ inline = [
+ "sudo apt -y update",
+ "sleep 15",
+ "sudo apt -y update",
+ "sudo apt -y install apache2",
+ "sudo systemctl start apache2",
+ "sudo chown -R ubuntu:ubuntu /var/www/html",
+ "chmod +x *.sh",
+ "PLACEHOLDER=${var.placeholder} WIDTH=${var.width} HEIGHT=${var.height} PREFIX=${var.prefix} ./deploy_app.sh",
+ "sudo apt -y install cowsay",
+ "cowsay Mooooooooooo!",
+ ]
+
+ connection {
+ type = "ssh"
+ user = "ubuntu"
+ private_key = tls_private_key.hashicat.private_key_pem
+ host = aws_eip.hashicat.public_ip
+ }
+ }
+}
+
+resource "tls_private_key" "hashicat" {
+ algorithm = "ED25519"
+}
+
+locals {
+ private_key_filename = "${var.prefix}-ssh-key.pem"
+}
+
+resource "aws_key_pair" "hashicat" {
+ key_name = local.private_key_filename
+ public_key = tls_private_key.hashicat.public_key_openssh
+}
diff --git a/remote_backend.tf b/remote_backend.tf
new file mode 100644
index 000000000..e2983d0cf
--- /dev/null
+++ b/remote_backend.tf
@@ -0,0 +1,9 @@
+terraform {
+ backend "remote" {
+ hostname = "app.terraform.io"
+ organization = "pola-deltek-session2"
+ workspaces {
+ name = "hashicat-aws"
+ }
+ }
+}
diff --git a/terraform.tfvars.example b/terraform.tfvars.example
deleted file mode 100644
index 0d7ce6eb6..000000000
--- a/terraform.tfvars.example
+++ /dev/null
@@ -1,5 +0,0 @@
-# Rename or copy this file to terraform.tfvars
-# Prefix must be all lowercase letters, digits, and hyphens.
-# Make sure it is at least 5 characters long.
-
-# prefix = "yourname"