Skip to content

Commit

Permalink
Merge pull request #12 from superluminar-io/improvements
Browse files Browse the repository at this point in the history
Small improvements
  • Loading branch information
tillkahlbrock authored Aug 31, 2022
2 parents a7b1825 + 512488d commit 5af3a3e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
4 changes: 4 additions & 0 deletions 0-bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Let’s get started by bootstrapping Terraform and out AWS environment.

## IDE
For the whole workshop we recommend to set up your IDE with Terraform support or to use an IDE with Terraform support
(e.g. [VS Code](https://code.visualstudio.com/) / [Terraform extension](https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform))

## AWS credentials setup

Before you start you will need
Expand Down
6 changes: 3 additions & 3 deletions 1-getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Let’s extend the stack and deploy more resources:
</body>
</html>
```
3. Replace the `main.tf` file:
3. Replace the `main.tf` file with:
```tf
terraform {
required_version = "~> 1.1.7"
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions 1-getting-started/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
terraform {
required_version = "~> 1.1.7"

backend "s3" {
key = "terraform.tfstate"
region = "eu-central-1"
}
}

provider "aws" {
Expand Down
4 changes: 2 additions & 2 deletions 2-third-party/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
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 @@ -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"
Expand All @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions 5-parameterization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand All @@ -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 {
Expand Down Expand Up @@ -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";
Expand All @@ -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 {
Expand Down
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,11 @@ The workshop empowers you to know the core concepts of *infrastructure as code*
* ✅ Deploy multiple environments (e.g. staging and prod)
* ✅ Implement a feature flag and learn more about parameterization


## 👾 Prerequisites

Before jumping to the first lab, please double-check the list and prepare your computer.

- Follow the instructions in the [bootstrap section](./0-bootstrap)
- [Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli)
- [AWS credentials in the terminal](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)
- IDE with Terraform support (e.g. [VS Code](https://code.visualstudio.com/) / [Terraform extension](https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform))
- [tfenv (recommended)](https://github.com/tfutils/tfenv)

## 🤓 Labs

We recommend you walk through the labs step by step and follow the instructions. Feel free to further extend the stack, play around with resources and dive deeper. Have fun ✌️

0. [Boostrap Environment](./0-bootstrap) Please double-check the instructions and set up your working environment
1. [Getting Started](./1-getting-started): Get started with Terraform, deploy some AWS resources, and create a remote backend for the Terraform state
2. [Third Party](./2-third-party/): Use a third-party *module* to easily build and deploy an AWS Lambda function
3. [Module Composition](./3-module-composition/): Improve the growing codebase by introducing custom modules and module composition
Expand Down

0 comments on commit 5af3a3e

Please sign in to comment.