Skip to content

Commit

Permalink
Do not deploy infrastructure to Ireland
Browse files Browse the repository at this point in the history
  • Loading branch information
tillkahlbrock committed Aug 17, 2022
1 parent 933d586 commit d5d73fa
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 35 deletions.
14 changes: 7 additions & 7 deletions 1-getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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" {}
Expand Down Expand Up @@ -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" {}
Expand Down Expand Up @@ -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.).
Expand All @@ -120,20 +120,20 @@ 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 {
required_version = "~> 1.1.7"
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" {}
Expand Down
2 changes: 1 addition & 1 deletion 1-getting-started/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
}

provider "aws" {
region = "eu-west-1"
region = "eu-central-1"
}

data "aws_caller_identity" "current" {}
Expand Down
10 changes: 5 additions & 5 deletions 2-third-party/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" {}
Expand Down Expand Up @@ -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! 👋"
Expand All @@ -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" {}
Expand Down
4 changes: 2 additions & 2 deletions 2-third-party/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

Expand Down
4 changes: 2 additions & 2 deletions 3-module-composition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
4 changes: 2 additions & 2 deletions 3-module-composition/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
6 changes: 3 additions & 3 deletions 4-multi-environment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -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"
}
```

Expand Down
8 changes: 4 additions & 4 deletions 4-multi-environment/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
4 changes: 2 additions & 2 deletions 4-multi-environment/staging/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
6 changes: 3 additions & 3 deletions 5-parameterization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions 5-parameterization/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
4 changes: 2 additions & 2 deletions 5-parameterization/staging/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit d5d73fa

Please sign in to comment.