Skip to content

Commit

Permalink
Merge branch 'simonhanmer:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sirlegendary authored Oct 30, 2024
2 parents e5b4ed1 + 903a43b commit bf41165
Show file tree
Hide file tree
Showing 10 changed files with 521 additions and 11 deletions.
203 changes: 203 additions & 0 deletions 202410-devops-playground.drawio

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This month we're going to explore the world of chaos engineering, using Amazon's
1. If you're following along in your own time, you'll need:
* An AWS account
* Terraform installed
1. The AWS account must contain an S3 bucket that will be used to store asset files.



## Live workshop environments
Expand Down
6 changes: 3 additions & 3 deletions steps/init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ Most of the terraform files in this workshop use the same variables, so we'll cr
panda_name = "<some_panda_name>"
```

If you're running this as part of the live session, replace `<some_panda_name>` with the name we'll provide you with and `<asset_bucket>` with `630895193694-eu-west-2-oct-assets`, otherwise feel free to use your own details, or similar.
If you're running this as part of the live session, replace `<some_panda_name>` with the name we'll provide you with, otherwise feel free to use your own details, or similar.


## Deploying the infrastructure
Once you have a set of AWS credentials and you've setup the `common.tfvars` file, you can deploy the infrastructure by making sure you're in the `steps/init` folder.

Firstly, we need to initialise our Terraform environment by running the command `terraform init`. This will download the required providers and setup an environment ready to use.

Once initialised, it's always good practice to check our Terraform code, and we can do this with the commands `teraform plan --var-file ../common/common.tfvars`. This will show us what Terraform is going to do.
Once initialised, it's always good practice to check our Terraform code, and we can do this with the commands `terraform plan --var-file ../common/common.tfvars`. This will show us what Terraform is going to do.

If the command runs ok, we can then apply the changes with `terraform apply --auto-approve --var-file ../common/common.tfvars`. This will create the infrastructure in the specified AWS account.

Expand All @@ -55,7 +55,7 @@ Outputs:
fis_iam_role = "funky_fis_iam_role"
fis_log_group = "/aws/fis/funky-fis-logs"
```
:information_source: Make a note of the outputß values as we'll need these later.
:information_source: Make a note of the output values as we'll need these later.

## Sharing the configuration with other steps
To allow the following steps in the workshop to use configuration we've just created, we'll store the details in a Terraform statefile `statefiles/base_config.tfstate`.
Expand Down
31 changes: 31 additions & 0 deletions steps/init/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,34 @@ output "fis_log_group" {
description = "Log Group for FIS."
value = aws_cloudwatch_log_group.log_group.name
}


output "public_subnet_details" {
description = "Details of the public subnets."
value = module.vpc.public_subnet_details
}

output "public_subnet_ids" {
description = "IDs of the public subnets."
value = module.vpc.public_subnet_ids
}

output "vpc_security_group_id" {
description = "ID of the VPC Security Group."
value = module.vpc.security_group_id
}

output "subnet_cidr_ranges" {
description = "CIDR Range for Subnets."
value = local.subnet_cidr_ranges
}

output "vpc_cidr_ranges" {
description = "CIDR Range for VPC."
value = local.vpc_cidr_range
}

output "vpc_id" {
description = "ID of the VPC."
value = module.vpc.vpc_id
}
71 changes: 70 additions & 1 deletion steps/init/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,76 @@ variable "region" {

locals {
playground_name = "devops_playground_oct2024"
panda_name_list = ["funky", "sad"]
panda_name_list = [
"funny",
"sweet",
"proud",
"suited",
"loved",
"firm",
"settling",
"premium",
"feasible",
"welcome",
"pumped",
"trusty",
"rational",
"moving",
"fast",
"social",
"logical",
"on",
"driving",
"perfect",
"equal",
"becoming",
"still",
"touched",
"fair",
"quiet",
"ample",
"master",
"fun",
"big",
"full",
"credible",
"inspired",
"pet",
"willing",
"guiding",
"useful",
"close",
"smashing",
"stunning",
"musical",
"evolved",
"teaching",
"artistic",
"learning",
"singular",
"funky",
"optimal",
"loving",
"measured",
"whole",
"verified",
"finer",
"glorious",
"outgoing",
"living",
"refined",
"valued",
"champion",
"integral",
"topical",
"humble",
"valid",
"patient",
"accurate",
"allowed",
"tight",
"uncommon"
]
panda_number = index(local.panda_name_list, var.panda_name)

resource_suffix = "${var.panda_name}_${local.playground_name}"
Expand Down
4 changes: 2 additions & 2 deletions steps/step01/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Please be aware that we're deliberately keeping this configuration simple to red
## Pre-requisites
Before we go further with the step, we need to ensure that
1. We have some active AWS credentials,
1. We have deployed the base inftastructure in the [init](../init/README.md) step.
1. We have deployed the base infrastructure in the [init](../init/README.md) step.
1. This deployment assumes there is a route53 hosted zone in place, pointing to the domain referenced in `variables.tf`. If you don't have a hosted zone/domain, ignore this and use the url with an IP, but be aware that the IP may change if the server is stopped and started again.

## Deploying an environment to test
To deploy the environment, we need to run the Terraform code in the `step01` directory.

Firstly, we need to initialise our Terraform environment by running the command `terraform init`. This will download the required providers and setup an environment ready to use.

Once initialised, it's always good practice to check our Terraform code, and we can do this with the commands `teraform plan --var-file ../common/common.tfvars`. This will show us what Terraform is going to do.
Once initialised, it's always good practice to check our Terraform code, and we can do this with the commands `terraform plan --var-file ../common/common.tfvars`. This will show us what Terraform is going to do.

If the command runs ok, we can then apply the changes with `terraform apply --auto-approve --var-file ../common/common.tfvars`. This will create the infrastructure in the specified AWS account.

Expand Down
71 changes: 70 additions & 1 deletion steps/step01/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,76 @@ variable "region" {

locals {
playground_name = "devops_playground_oct2024"
panda_name_list = ["funky", "sad"]
panda_name_list = [
"funny",
"sweet",
"proud",
"suited",
"loved",
"firm",
"settling",
"premium",
"feasible",
"welcome",
"pumped",
"trusty",
"rational",
"moving",
"fast",
"social",
"logical",
"on",
"driving",
"perfect",
"equal",
"becoming",
"still",
"touched",
"fair",
"quiet",
"ample",
"master",
"fun",
"big",
"full",
"credible",
"inspired",
"pet",
"willing",
"guiding",
"useful",
"close",
"smashing",
"stunning",
"musical",
"evolved",
"teaching",
"artistic",
"learning",
"singular",
"funky",
"optimal",
"loving",
"measured",
"whole",
"verified",
"finer",
"glorious",
"outgoing",
"living",
"refined",
"valued",
"champion",
"integral",
"topical",
"humble",
"valid",
"patient",
"accurate",
"allowed",
"tight",
"uncommon"
]
panda_number = index(local.panda_name_list, var.panda_name)

resource_suffix = "${var.panda_name}_${local.playground_name}"
Expand Down
71 changes: 70 additions & 1 deletion steps/step02/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,76 @@ variable "region" {

locals {
playground_name = "devops_playground_oct2024"
panda_name_list = ["funky", "sad"]
panda_name_list = [
"funny",
"sweet",
"proud",
"suited",
"loved",
"firm",
"settling",
"premium",
"feasible",
"welcome",
"pumped",
"trusty",
"rational",
"moving",
"fast",
"social",
"logical",
"on",
"driving",
"perfect",
"equal",
"becoming",
"still",
"touched",
"fair",
"quiet",
"ample",
"master",
"fun",
"big",
"full",
"credible",
"inspired",
"pet",
"willing",
"guiding",
"useful",
"close",
"smashing",
"stunning",
"musical",
"evolved",
"teaching",
"artistic",
"learning",
"singular",
"funky",
"optimal",
"loving",
"measured",
"whole",
"verified",
"finer",
"glorious",
"outgoing",
"living",
"refined",
"valued",
"champion",
"integral",
"topical",
"humble",
"valid",
"patient",
"accurate",
"allowed",
"tight",
"uncommon"
]
panda_number = index(local.panda_name_list, var.panda_name)

resource_suffix = "${var.panda_name}_${local.playground_name}"
Expand Down
2 changes: 1 addition & 1 deletion steps/step03/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This time, for our alarm to generate an alert, we need to create traffic going t
```bash
while :
do
http_code=$(curl -s -o /dev/null -w "%{http_code}" http:_load_balancer_url_)
http_code=$(curl -s -o /dev/null -w "%{http_code}" http://step03-funky-elb-591817578.eu-west-2.elb.amazonaws.com)
if [ $http_code -eq 200 ]; then
printf "."
else
Expand Down
Loading

0 comments on commit bf41165

Please sign in to comment.