From f47c9b0aadcc7a77562498376c317b5d35375165 Mon Sep 17 00:00:00 2001 From: Eslam Date: Thu, 27 Oct 2022 13:25:35 +0000 Subject: [PATCH 1/6] Added remote backend --- .terraform.lock.hcl | 40 ++++++++++++++++++++++++++++++++++++++++ README.md | 1 + remote_backend.tf | 9 +++++++++ terraform.tfvars.example | 5 ----- 4 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 .terraform.lock.hcl create mode 100644 remote_backend.tf delete mode 100644 terraform.tfvars.example diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl new file mode 100644 index 000000000..62414ebea --- /dev/null +++ b/.terraform.lock.hcl @@ -0,0 +1,40 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/azurerm" { + version = "2.60.0" + constraints = "2.60.0" + hashes = [ + "h1:b20pVDyPMFeM2fMZiYM7aaDciPP+2E5HBuxUaQN/t6E=", + "zh:3c0394be85ba893bd4c0cdab0bf811347952ea2cc0f73beb311554ce460d713d", + "zh:490980ef69b889f95a471db9e67b31ea1e559527f66072475a9f4c57bcf58e8c", + "zh:6dabe4dc0fe5a5a4deca941223f46486b29dfbdd7ee4ce8d32da2fda3e050122", + "zh:7981f19b725fc1bca324f530832efe1f2dd9bf46ef6db5fcb46f856f70d2bf11", + "zh:810cec378de74cf7dda58083897c1bf6bea0191295ed091406a0af12fb558fcc", + "zh:83b90b92e0d450215822585c5bb0d0a7659cbd7f77791033999ac2187a97b29f", + "zh:a9c311d4d16246ba2fdbc55721df364317bb20ee2d8d76122015bb6a24c60b47", + "zh:e1d72e94a753383564ed2c9647a6d038eba6c2346fb961d1f7a750587ef7dea0", + "zh:e4fd83bdf7fcbd94105fe0e15643a2ed9519a54143e282d8f5512443792010db", + "zh:f5a7d6f1d0b60b531915f114a29a68689d6d0c2f349ce0e838e4770769590e94", + "zh:f94fb4872483dd6ac4ea1ef8f86dad4b8ef21f22d3067fddd643745e58140691", + ] +} + +provider "registry.terraform.io/hashicorp/null" { + version = "3.2.0" + hashes = [ + "h1:pfjuwssoCoBDRbutlVLAP8wiDrkQ3G4d3rs+f7uSh2A=", + "zh:1d88ea3af09dcf91ad0aaa0d3978ca8dcb49dc866c8615202b738d73395af6b5", + "zh:3844db77bfac2aca43aaa46f3f698c8e5320a47e838ee1318408663449547e7e", + "zh:538fadbd87c576a332b7524f352e6004f94c27afdd3b5d105820d328dc49c5e3", + "zh:56def6f00fc2bc9c3c265b841ce71e80b77e319de7b0f662425b8e5e7eb26846", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:8fce56e5f1d13041d8047a1d0c93f930509704813a28f8d39c2b2082d7eebf9f", + "zh:989e909a5eca96b8bdd4a0e8609f1bd525949fd226ae870acedf2da0c55b0451", + "zh:99ddc34ad13e04e9c3477f5422fbec20fc13395ff940720c287bfa5c546d2fbc", + "zh:b546666da4b4b60c0eec23faab7f94dc900e48f66b5436fc1ac0b87c6709ef04", + "zh:d56643cb08cba6e074d70c4af37d5de2bd7c505f81d866d6d47c9e1d28ec65d1", + "zh:f39ac5ff9e9d00e6a670bce6825529eded4b0b4966abba36a387db5f0712d7ba", + "zh:fe102389facd09776502327352be99becc1ac09e80bc287db84a268172be641f", + ] +} diff --git a/README.md b/README.md index 1a7d040c3..44ca83e77 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,4 @@ Hashicat: A terraform built application for use in Hashicorp workshops. Includes the "Meow World" website. 😻 [![CircleCI](https://circleci.com/gh/hashicorp/hashicat-azure.svg?style=svg)](https://circleci.com/gh/hashicorp/hashicat-azure) +Eslam Mahmoud \ No newline at end of file diff --git a/remote_backend.tf b/remote_backend.tf new file mode 100644 index 000000000..0e07eb218 --- /dev/null +++ b/remote_backend.tf @@ -0,0 +1,9 @@ +terraform { + backend "remote" { + hostname = "app.terraform.io" + organization = "TF_Training_Eslam" + workspaces { + name = "hashicat-azure" + } + } +} diff --git a/terraform.tfvars.example b/terraform.tfvars.example deleted file mode 100644 index fb073c663..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" From 867e10bcd49774f5920f2c7393692a4a9ef9abbc Mon Sep 17 00:00:00 2001 From: Eslam Mahmoud <42860799+Eslam10@users.noreply.github.com> Date: Thu, 27 Oct 2022 15:52:51 +0200 Subject: [PATCH 2/6] Update deploy_app.sh --- files/deploy_app.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/deploy_app.sh b/files/deploy_app.sh index fddd2038e..2a8083389 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. + This is a catchy slogan :d. @@ -19,4 +19,4 @@ cat << EOM > /var/www/html/index.html EOM -echo "Script complete." \ No newline at end of file +echo "Script complete." From 7ed15c5ef2d1ac2e16829c0cbfb46baf9d6404be Mon Sep 17 00:00:00 2001 From: Eslam Date: Thu, 27 Oct 2022 14:01:37 +0000 Subject: [PATCH 3/6] Added the first tag --- main.tf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index f299aa305..f4b6eb383 100644 --- a/main.tf +++ b/main.tf @@ -135,7 +135,9 @@ resource "azurerm_virtual_machine" "catapp" { disable_password_authentication = false } - tags = {} + tags = { + Department = "devops" + } # Added to allow destroy to work correctly. depends_on = [azurerm_network_interface_security_group_association.catapp-nic-sg-ass] From 64477e9ec5e9359be77f7a0cc9b5fe21bf8f6d57 Mon Sep 17 00:00:00 2001 From: Eslam Date: Thu, 27 Oct 2022 14:03:41 +0000 Subject: [PATCH 4/6] Added the second tag --- main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/main.tf b/main.tf index f4b6eb383..aad9c9a06 100644 --- a/main.tf +++ b/main.tf @@ -137,6 +137,7 @@ resource "azurerm_virtual_machine" "catapp" { tags = { Department = "devops" + Billable = "true" } # Added to allow destroy to work correctly. From d998b791917dbfbbfcdc031306f01c717f4f919c Mon Sep 17 00:00:00 2001 From: Eslam Date: Thu, 27 Oct 2022 14:14:55 +0000 Subject: [PATCH 5/6] Added network module --- network.tf | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 network.tf diff --git a/network.tf b/network.tf new file mode 100644 index 000000000..3cb72d57b --- /dev/null +++ b/network.tf @@ -0,0 +1,5 @@ +module "network" { + source = "app.terraform.io/TF_Training_Eslam/network/azurerm" + version = "3.5.0" + resource_group_name = "eslam_rg" +} \ No newline at end of file From b15fe0be724679dd5d8cf1c18e9283d8ce41a4e0 Mon Sep 17 00:00:00 2001 From: Eslam Date: Thu, 27 Oct 2022 14:20:33 +0000 Subject: [PATCH 6/6] Added network module --- network.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/network.tf b/network.tf index 3cb72d57b..b95c0a45f 100644 --- a/network.tf +++ b/network.tf @@ -1,5 +1,5 @@ -module "network" { - source = "app.terraform.io/TF_Training_Eslam/network/azurerm" - version = "3.5.0" - resource_group_name = "eslam_rg" +module "network" { + source = "app.terraform.io/TF_Training_Eslam/network/azurerm" + version = "3.5.0" + resource_group_name = azurerm_resource_group.myresourcegroup.name } \ No newline at end of file