From bf83e89205afe3c126f8971f14e3c870906b6aa9 Mon Sep 17 00:00:00 2001 From: Fernando Rubbo Date: Wed, 11 Sep 2019 08:53:52 -0300 Subject: [PATCH 1/8] Update README.md --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f4d6e4a64..d44cdb1cc6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -# Configuring your **dev** environment +# Managing infrastructure as code with Terraform, Cloud Build, and GitOps + +This is the repo for the [Managing infrastructure as code with Terraform, Cloud Build, and GitOps](https://cloud.google.com/solutions/managing-infrastructure-as-code) tutorial. This tutorial explains how to manage infrastructure as code with Terraform and Cloud Build using the popular GitOps methodology. + +## Configuring your **dev** environment Just for demostration, this step will: 1. Configure an apache2 http server on network '**dev**' and subnet '**dev**-subnet-01' @@ -12,7 +16,7 @@ terraform apply terraform destroy ``` -# Promoting your environment to **production** +## Promoting your environment to **production** Once you have tested your app (in this example an apache2 http server), you can promote your configuration to prodution. This step will: 1. Configure an apache2 http server on network '**prod**' and subnet '**prod**-subnet-01' From e6bcec81715f52a9a9c7f547926fe4a05c102268 Mon Sep 17 00:00:00 2001 From: fernandorubbo Date: Thu, 10 Jun 2021 14:25:56 +0000 Subject: [PATCH 2/8] Moving to terraform 1.0.0 --- cloudbuild.yaml | 6 +++--- environments/dev/main.tf | 2 +- environments/dev/versions.tf | 2 +- environments/prod/main.tf | 2 +- environments/prod/versions.tf | 2 +- modules/firewall/versions.tf | 2 +- modules/http_server/versions.tf | 2 +- modules/vpc/main.tf | 2 +- modules/vpc/versions.tf | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 84f5365cec..a2e241289d 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -25,7 +25,7 @@ steps: echo "***********************" - id: 'tf init' - name: 'hashicorp/terraform:0.11.14' + name: 'hashicorp/terraform:1.0.0' entrypoint: 'sh' args: - '-c' @@ -50,7 +50,7 @@ steps: # [START tf-plan] - id: 'tf plan' - name: 'hashicorp/terraform:0.11.14' + name: 'hashicorp/terraform:1.0.0' entrypoint: 'sh' args: - '-c' @@ -76,7 +76,7 @@ steps: # [START tf-apply] - id: 'tf apply' - name: 'hashicorp/terraform:0.11.14' + name: 'hashicorp/terraform:1.0.0' entrypoint: 'sh' args: - '-c' diff --git a/environments/dev/main.tf b/environments/dev/main.tf index a77cb88e91..a28b76be75 100644 --- a/environments/dev/main.tf +++ b/environments/dev/main.tf @@ -14,7 +14,7 @@ locals { - "env" = "dev" + env = "dev" } provider "google" { diff --git a/environments/dev/versions.tf b/environments/dev/versions.tf index aecd2473e3..4cc81b29fa 100644 --- a/environments/dev/versions.tf +++ b/environments/dev/versions.tf @@ -14,5 +14,5 @@ terraform { - required_version = "~> 0.11.0" + required_version = "~> 1.0.0" } diff --git a/environments/prod/main.tf b/environments/prod/main.tf index 642fe67ba2..0c7726235e 100644 --- a/environments/prod/main.tf +++ b/environments/prod/main.tf @@ -14,7 +14,7 @@ locals { - "env" = "prod" + env = "prod" } provider "google" { diff --git a/environments/prod/versions.tf b/environments/prod/versions.tf index aecd2473e3..4cc81b29fa 100644 --- a/environments/prod/versions.tf +++ b/environments/prod/versions.tf @@ -14,5 +14,5 @@ terraform { - required_version = "~> 0.11.0" + required_version = "~> 1.0.0" } diff --git a/modules/firewall/versions.tf b/modules/firewall/versions.tf index aecd2473e3..4cc81b29fa 100644 --- a/modules/firewall/versions.tf +++ b/modules/firewall/versions.tf @@ -14,5 +14,5 @@ terraform { - required_version = "~> 0.11.0" + required_version = "~> 1.0.0" } diff --git a/modules/http_server/versions.tf b/modules/http_server/versions.tf index aecd2473e3..4cc81b29fa 100644 --- a/modules/http_server/versions.tf +++ b/modules/http_server/versions.tf @@ -14,5 +14,5 @@ terraform { - required_version = "~> 0.11.0" + required_version = "~> 1.0.0" } diff --git a/modules/vpc/main.tf b/modules/vpc/main.tf index 36b08f5b43..8fce4ab20d 100644 --- a/modules/vpc/main.tf +++ b/modules/vpc/main.tf @@ -15,7 +15,7 @@ module "vpc" { source = "terraform-google-modules/network/google" - version = "0.6.0" + version = "3.3.0" project_id = "${var.project}" network_name = "${var.env}" diff --git a/modules/vpc/versions.tf b/modules/vpc/versions.tf index aecd2473e3..4cc81b29fa 100644 --- a/modules/vpc/versions.tf +++ b/modules/vpc/versions.tf @@ -14,5 +14,5 @@ terraform { - required_version = "~> 0.11.0" + required_version = "~> 1.0.0" } From d8fc5e5d71ab526a46a7ae31ca642175c488fe3f Mon Sep 17 00:00:00 2001 From: nardo-google Date: Tue, 27 Sep 2022 14:59:31 +0200 Subject: [PATCH 3/8] Update main.tf debian-9 not available anymore. not sure if there's an option in terraform to say "take latest image". So I picket 11. --- modules/http_server/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/http_server/main.tf b/modules/http_server/main.tf index 6f05187f34..e790ce329e 100644 --- a/modules/http_server/main.tf +++ b/modules/http_server/main.tf @@ -27,7 +27,7 @@ resource "google_compute_instance" "http_server" { boot_disk { initialize_params { - image = "debian-cloud/debian-9" + image = "debian-cloud/debian-11" } } From 552f3b97c06a3600913880c5599b7bac345ae4a6 Mon Sep 17 00:00:00 2001 From: nardo-google Date: Tue, 27 Sep 2022 23:13:16 +0200 Subject: [PATCH 4/8] Update cloudbuild.yaml fixed typo: oficial -> official --- cloudbuild.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index a2e241289d..ca83a0086e 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -86,7 +86,7 @@ steps: terraform apply -auto-approve else echo "***************************** SKIPPING APPLYING *******************************" - echo "Branch '$BRANCH_NAME' does not represent an oficial environment." + echo "Branch '$BRANCH_NAME' does not represent an official environment." echo "*******************************************************************************" fi # [END tf-apply] From 00905208aa6ab328a6c32fb4338ac19ae73a0858 Mon Sep 17 00:00:00 2001 From: TL33 Date: Mon, 11 Mar 2024 04:16:36 -0400 Subject: [PATCH 5/8] update project ids and buckets --- environments/dev/backend.tf | 2 +- environments/dev/terraform.tfvars | 2 +- environments/prod/backend.tf | 2 +- environments/prod/terraform.tfvars | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/environments/dev/backend.tf b/environments/dev/backend.tf index 33a807a336..8c21f52e26 100644 --- a/environments/dev/backend.tf +++ b/environments/dev/backend.tf @@ -15,7 +15,7 @@ terraform { backend "gcs" { - bucket = "PROJECT_ID-tfstate" + bucket = "hosting7l33-tfstate" prefix = "env/dev" } } diff --git a/environments/dev/terraform.tfvars b/environments/dev/terraform.tfvars index cb8a5a1bbc..b92afd495e 100644 --- a/environments/dev/terraform.tfvars +++ b/environments/dev/terraform.tfvars @@ -1 +1 @@ -project="PROJECT_ID" \ No newline at end of file +project="hosting7l33" \ No newline at end of file diff --git a/environments/prod/backend.tf b/environments/prod/backend.tf index 7ed343b1a2..c204914f1e 100644 --- a/environments/prod/backend.tf +++ b/environments/prod/backend.tf @@ -15,7 +15,7 @@ terraform { backend "gcs" { - bucket = "PROJECT_ID-tfstate" + bucket = "hosting7l33-tfstate" prefix = "env/prod" } } diff --git a/environments/prod/terraform.tfvars b/environments/prod/terraform.tfvars index cb8a5a1bbc..b92afd495e 100644 --- a/environments/prod/terraform.tfvars +++ b/environments/prod/terraform.tfvars @@ -1 +1 @@ -project="PROJECT_ID" \ No newline at end of file +project="hosting7l33" \ No newline at end of file From 83d758d6978d41539645cbefdaf8804895e20fe6 Mon Sep 17 00:00:00 2001 From: tl212 Date: Mon, 11 Mar 2024 04:51:00 -0400 Subject: [PATCH 6/8] fixing http firewall target --- modules/firewall/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/firewall/main.tf b/modules/firewall/main.tf index 5e40f7089f..6945d27aa4 100644 --- a/modules/firewall/main.tf +++ b/modules/firewall/main.tf @@ -27,6 +27,6 @@ resource "google_compute_firewall" "allow-http" { ports = ["80"] } - target_tags = ["http-server2"] + target_tags = ["htpp-server"] source_ranges = ["0.0.0.0/0"] } From 07f96ca3bc7fab1efd6299f16b36e65d33e60e9b Mon Sep 17 00:00:00 2001 From: tl212 Date: Mon, 11 Mar 2024 06:49:32 -0400 Subject: [PATCH 7/8] fixing http firewall test-2 From 46492d097b34638f60215324495f215502cf52af Mon Sep 17 00:00:00 2001 From: tl212 Date: Mon, 11 Mar 2024 08:41:47 -0400 Subject: [PATCH 8/8] fixing http firewall test-3