From 512488de6fc243067553b6b2c760cf3e28cc6127 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 31 Aug 2022 11:46:26 +0200 Subject: [PATCH] indicate more precise where the bucket name needs to go --- 1-getting-started/README.md | 6 +++--- 1-getting-started/main.tf | 5 +++++ 2-third-party/README.md | 4 ++-- 3-module-composition/README.md | 4 ++-- 5-parameterization/README.md | 8 ++++---- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/1-getting-started/README.md b/1-getting-started/README.md index 9346803..ed32290 100644 --- a/1-getting-started/README.md +++ b/1-getting-started/README.md @@ -47,7 +47,7 @@ Let’s extend the stack and deploy more resources: ``` -3. Replace the `main.tf` file: +3. Replace the `main.tf` file with: ```tf terraform { required_version = "~> 1.1.7" @@ -107,8 +107,8 @@ 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-central-1). Copy the name of the bucket afterward. -2. Go to the file `main.tf` and replace it: +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 and keep for use in **step 3** as well as other workshop units. +2. Go to the file `main.tf` and replace it with: ```tf terraform { required_version = "~> 1.1.7" diff --git a/1-getting-started/main.tf b/1-getting-started/main.tf index 5ca8c2f..2203408 100644 --- a/1-getting-started/main.tf +++ b/1-getting-started/main.tf @@ -1,5 +1,10 @@ terraform { required_version = "~> 1.1.7" + + backend "s3" { + key = "terraform.tfstate" + region = "eu-central-1" + } } provider "aws" { diff --git a/2-third-party/README.md b/2-third-party/README.md index db2d4c4..02c1605 100644 --- a/2-third-party/README.md +++ b/2-third-party/README.md @@ -14,7 +14,7 @@ In the first lab, we bootstrapped Terraform and got familiar with the very basic }; }; ``` -4. Now, go back to the `main.tf` file and replace it: +4. Now, go back to the `main.tf` file and replace it with: ```tf terraform { required_version = "~> 1.1.7" @@ -82,7 +82,7 @@ That’s it for the Lambda function. Let’s go to the API Gateway. ## API Gateway -1. Replace the `main.tf` file: +1. Replace the `main.tf` file with: ```tf terraform { required_version = "~> 1.1.7" diff --git a/3-module-composition/README.md b/3-module-composition/README.md index 501e42f..82e7d06 100644 --- a/3-module-composition/README.md +++ b/3-module-composition/README.md @@ -100,7 +100,7 @@ The previous lab introduced a third-party module to easily deploy a Lambda funct value = "http://${aws_s3_bucket_website_configuration.website.website_endpoint}" } ``` -17. Replace the root `main.tf` file: +17. Replace the root `main.tf` file with: ```tf terraform { required_version = "~> 1.1.7" @@ -123,7 +123,7 @@ The previous lab introduced a third-party module to easily deploy a Lambda funct source = "./modules/api" } ``` -18. Replace the root `outputs.tf` file: +18. Replace the root `outputs.tf` file with: ```tf output "api_url" { description = "Hello World API URL" diff --git a/5-parameterization/README.md b/5-parameterization/README.md index 8f7ce74..591610c 100644 --- a/5-parameterization/README.md +++ b/5-parameterization/README.md @@ -4,7 +4,7 @@ The API becomes more powerful in this lab, but we want to be careful and only ro ## Implement new feature -1. Go to the file `modules/api/variables.tf` and replace it: +1. Go to the file `modules/api/variables.tf` and replace it with: ``` variable "environment" { @@ -19,7 +19,7 @@ variable "enable_greeting_feature" { } ``` -2. Go to the file `modules/api/main.tf` and replace it: +2. Go to the file `modules/api/main.tf` and replace it with: ```tf locals { @@ -54,7 +54,7 @@ resource "aws_apigatewayv2_api" "hello_world" { } ``` -3. Go to the file `modules/api/functions/helloworld.js` and replace it: +3. Go to the file `modules/api/functions/helloworld.js` and replace it with: ```js const greetingEnabled = process.env.GREETING_ENABLED === "true"; @@ -77,7 +77,7 @@ The new feature wouldn’t appear after deployment (feel free to try it and depl ## Rollout -1. Go to the file `staging/main.tf` and replace it: +1. Go to the file `staging/main.tf` and replace it with: ```tf terraform {