From d5d73fa0802c5c06bba09a6c23dd51e9558a2046 Mon Sep 17 00:00:00 2001 From: Till Kahlbrock Date: Wed, 17 Aug 2022 11:27:55 +0200 Subject: [PATCH] Do not deploy infrastructure to Ireland --- 1-getting-started/README.md | 14 +++++++------- 1-getting-started/main.tf | 2 +- 2-third-party/README.md | 10 +++++----- 2-third-party/main.tf | 4 ++-- 3-module-composition/README.md | 4 ++-- 3-module-composition/main.tf | 4 ++-- 4-multi-environment/README.md | 6 +++--- 4-multi-environment/prod/main.tf | 8 ++++---- 4-multi-environment/staging/main.tf | 4 ++-- 5-parameterization/README.md | 6 +++--- 5-parameterization/prod/main.tf | 4 ++-- 5-parameterization/staging/main.tf | 4 ++-- 12 files changed, 35 insertions(+), 35 deletions(-) diff --git a/1-getting-started/README.md b/1-getting-started/README.md index 949f052..cef08e9 100644 --- a/1-getting-started/README.md +++ b/1-getting-started/README.md @@ -13,7 +13,7 @@ Let’s get started by bootstrapping Terraform and deploying some resources to A } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } ``` 3. Run `terraform init` @@ -24,7 +24,7 @@ Let’s get started by bootstrapping Terraform and deploying some resources to A } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } data "aws_caller_identity" "current" {} @@ -67,7 +67,7 @@ Let’s extend the stack and deploy more resources: } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } data "aws_caller_identity" "current" {} @@ -109,7 +109,7 @@ We also introduced an output: Output is very helpful to retrieve certain data af ```sh Outputs: -website_url = "http://hello-world-website-XXXXXXXXXXX.s3-website-eu-west-1.amazonaws.com" +website_url = "http://hello-world-website-XXXXXXXXXXX.s3-website-eu-central-1.amazonaws.com" ``` Thanks to the output, we can easily find the endpoint of the static website without navigating to the AWS Management Console. In addition, the output might be also interesting for automation (e.g. get the URL to run integration tests etc.). @@ -120,7 +120,7 @@ Before we continue and go to the next lab, we need to talk about the Terraform s Until now, we used local files for the Terraform state. That’s okay for a workshop but doesn’t work for production workloads. The problem is, that we always need the state to apply changes. So if you want to work on the same stack with a team or some form of automation, then you need to share the state with others. The recommended solution is a remote backend. In this workshop, we focus on an S3 bucket, but you have [different options](https://www.terraform.io/language/settings/backends). Instead of keeping the state locally, we upload the state to the S3 bucket and read the current status from there. -1. Create a new S3 bucket in the [AWS Management Console](https://s3.console.aws.amazon.com/s3/bucket/create?region=eu-west-1). Copy the name of the bucket afterward. +1. Create a new S3 bucket in the [AWS Management Console](https://s3.console.aws.amazon.com/s3/bucket/create?region=eu-central-1). Copy the name of the bucket afterward. 2. Go to the file `main.tf` and replace it: ```tf terraform { @@ -128,12 +128,12 @@ Until now, we used local files for the Terraform state. That’s okay for a work backend "s3" { key = "terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } data "aws_caller_identity" "current" {} diff --git a/1-getting-started/main.tf b/1-getting-started/main.tf index 67039c6..5ca8c2f 100644 --- a/1-getting-started/main.tf +++ b/1-getting-started/main.tf @@ -3,7 +3,7 @@ terraform { } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } data "aws_caller_identity" "current" {} diff --git a/2-third-party/README.md b/2-third-party/README.md index 2abfd15..db2d4c4 100644 --- a/2-third-party/README.md +++ b/2-third-party/README.md @@ -21,12 +21,12 @@ In the first lab, we bootstrapped Terraform and got familiar with the very basic backend "s3" { key = "terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } data "aws_caller_identity" "current" {} @@ -63,7 +63,7 @@ In the first lab, we bootstrapped Terraform and got familiar with the very basic } ``` 5. Run `terraform init`, then `terraform apply`, and confirm the changes with `yes`. -6. Go to the [Lambda console](https://eu-west-1.console.aws.amazon.com/lambda/home?region=eu-west-1#/functions/hello-world?tab=testing). You should see the deployed Lambda function. Now, scroll down a little bit and click on the `Test` button. Click on `Details`. You should see the output of the Lambda function: +6. Go to the [Lambda console](https://eu-central-1.console.aws.amazon.com/lambda/home?region=eu-central-1#/functions/hello-world?tab=testing). You should see the deployed Lambda function. Now, scroll down a little bit and click on the `Test` button. Click on `Details`. You should see the output of the Lambda function: ```json { "message": "Hello from Lambda! 👋" @@ -89,12 +89,12 @@ That’s it for the Lambda function. Let’s go to the API Gateway. backend "s3" { key = "terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } data "aws_caller_identity" "current" {} diff --git a/2-third-party/main.tf b/2-third-party/main.tf index 488db05..37a12db 100644 --- a/2-third-party/main.tf +++ b/2-third-party/main.tf @@ -3,11 +3,11 @@ terraform { } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" backend "s3" { key = "terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } } diff --git a/3-module-composition/README.md b/3-module-composition/README.md index b800a57..501e42f 100644 --- a/3-module-composition/README.md +++ b/3-module-composition/README.md @@ -107,12 +107,12 @@ The previous lab introduced a third-party module to easily deploy a Lambda funct backend "s3" { key = "terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } module "website" { diff --git a/3-module-composition/main.tf b/3-module-composition/main.tf index 9423c6e..bd880f3 100644 --- a/3-module-composition/main.tf +++ b/3-module-composition/main.tf @@ -3,12 +3,12 @@ terraform { backend "s3" { key = "terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } module "website" { diff --git a/4-multi-environment/README.md b/4-multi-environment/README.md index b858721..5ef84f6 100644 --- a/4-multi-environment/README.md +++ b/4-multi-environment/README.md @@ -97,12 +97,12 @@ With custom modules, we already have reusable components ready for a multi-envir backend "s3" { key = "staging/terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } module "website" { @@ -137,7 +137,7 @@ Repeat all steps we did to create a staging environment. Instead of creating a ` ```tf backend "s3" { key = "prod/terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } ``` diff --git a/4-multi-environment/prod/main.tf b/4-multi-environment/prod/main.tf index 29d0d35..24aee9c 100644 --- a/4-multi-environment/prod/main.tf +++ b/4-multi-environment/prod/main.tf @@ -3,22 +3,22 @@ terraform { backend "s3" { key = "prod/terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } module "website" { source = "../modules/website" - + environment = "prod" } module "api" { source = "../modules/api" - + environment = "prod" } diff --git a/4-multi-environment/staging/main.tf b/4-multi-environment/staging/main.tf index 1dc73e1..2308c23 100644 --- a/4-multi-environment/staging/main.tf +++ b/4-multi-environment/staging/main.tf @@ -3,12 +3,12 @@ terraform { backend "s3" { key = "staging/terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } module "website" { diff --git a/5-parameterization/README.md b/5-parameterization/README.md index e2bf791..8f7ce74 100644 --- a/5-parameterization/README.md +++ b/5-parameterization/README.md @@ -85,12 +85,12 @@ terraform { backend "s3" { key = "staging/terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } module "website" { @@ -117,7 +117,7 @@ module "api" { 4. Now, add the `name` query param to the URL, e.g.: ``` -https://XXXXXXXXXX.execute-api.eu-west-1.amazonaws.com/?name=alice +https://XXXXXXXXXX.execute-api.eu-central-1.amazonaws.com/?name=alice ``` 5. Here we go! The new feature works on staging. diff --git a/5-parameterization/prod/main.tf b/5-parameterization/prod/main.tf index 21f9b37..24aee9c 100644 --- a/5-parameterization/prod/main.tf +++ b/5-parameterization/prod/main.tf @@ -3,12 +3,12 @@ terraform { backend "s3" { key = "prod/terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } module "website" { diff --git a/5-parameterization/staging/main.tf b/5-parameterization/staging/main.tf index fa38115..72a6691 100644 --- a/5-parameterization/staging/main.tf +++ b/5-parameterization/staging/main.tf @@ -3,12 +3,12 @@ terraform { backend "s3" { key = "staging/terraform.tfstate" - region = "eu-west-1" + region = "eu-central-1" } } provider "aws" { - region = "eu-west-1" + region = "eu-central-1" } module "website" {