From e3f595473998882cfc138e930f17172b65e30756 Mon Sep 17 00:00:00 2001 From: Gal Szkolnik Date: Sun, 30 Jul 2023 13:53:38 +0000 Subject: [PATCH] Initialize terraform plan with auth details --- src/ASSIGNMENT-03/ASSIGNMENT-03.md | 14 ++++++++++++++ src/ASSIGNMENT-03/init.tf | 24 ++++++++++++++++++++++++ src/ASSIGNMENT-03/local.init.tf.template | 8 ++++++++ 3 files changed, 46 insertions(+) create mode 100644 src/ASSIGNMENT-03/ASSIGNMENT-03.md create mode 100644 src/ASSIGNMENT-03/init.tf create mode 100644 src/ASSIGNMENT-03/local.init.tf.template diff --git a/src/ASSIGNMENT-03/ASSIGNMENT-03.md b/src/ASSIGNMENT-03/ASSIGNMENT-03.md new file mode 100644 index 0000000..042942b --- /dev/null +++ b/src/ASSIGNMENT-03/ASSIGNMENT-03.md @@ -0,0 +1,14 @@ +# 3rd Assignment + +## Main Challanges + +My main challange is the lack of experience with Azure envrionments. + +However, the requiremetns were pretty straight forward, and so, I +started with reviewing the tools available to work with terrafom and +Azure. +The tool that seems to be a good fit, is the [aztexport](https://github.com/Azure/aztfexport) +utility, which exports an existing azure state into a collecton of +terraform plan files. + +This helped me with understanding the particulars of the environment. \ No newline at end of file diff --git a/src/ASSIGNMENT-03/init.tf b/src/ASSIGNMENT-03/init.tf new file mode 100644 index 0000000..cfc2047 --- /dev/null +++ b/src/ASSIGNMENT-03/init.tf @@ -0,0 +1,24 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~>2.0" + } + + random = { + source = "hashicorp/random" + version = "~>3.0" + } + } +} + +provider "azurerm" { + features {} + + subscription_id = "ced61991-09cf-4e19-a773-fa454609e1ed" + tenant_id = "6b4b1b0d-23f1-4063-bbbd-b65e2984b893" + # Client ID of SzTerraform service-prinicipal: + # Azure Active Directory -> App registration -> SzTerraform + client_id = "0de043f8-9006-4791-baa1-f48a60809c1c" + client_secret = local.secret +} diff --git a/src/ASSIGNMENT-03/local.init.tf.template b/src/ASSIGNMENT-03/local.init.tf.template new file mode 100644 index 0000000..ca33117 --- /dev/null +++ b/src/ASSIGNMENT-03/local.init.tf.template @@ -0,0 +1,8 @@ +# Copy this file into local.init.tf (which is in .gitignore) as fill +# in the secret's value + +locals { + # Secret for the SzTerraform service-prinicipal: + # Azure Active Directory -> App registration -> SzTerraform -> Certificates & secrets + secret = "" +} \ No newline at end of file