Skip to content

Commit adec615

Browse files
nobodynateandrew-aikennobodynate
authored
Standardize terraform provider file and minimum Terraform version (#405)
* Standardize terraform provider file and min TF version * Remove duplicate version block * override the default variable value * Keep higher AWS provider versions for ec2_ssrf and sqs_flag_shop These scenarios require higher provider versions due to specific features: - ec2_ssrf: >= 5.61.0 - sqs_flag_shop: >= 5.74.0 Tests were failing when downgraded to >= 5.0.0. * Fix rce_web_app duplicate provider config Remove provider.tf and update settings.tf instead, since rce_web_app already uses settings.tf for provider configuration. --------- Co-authored-by: Andrew Aiken <andrew.aiken@machinemetrics.com> Co-authored-by: nobodynate <nate.wilson@rhinosecuritylabs.com>
1 parent 88be1a9 commit adec615

22 files changed

Lines changed: 196 additions & 88 deletions

File tree

.github/workflows/scenario-terraform-compatibility.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
if [[ -n "${VAR_MAP[$var]}" ]]; then
9393
echo " \"$var\": ${VAR_MAP[$var]}," >> $TFVARS_FILE
9494
else
95-
echo " \"$var\": \"junk\"," >> $TFVARS_FILE
95+
echo " \"$var\": \"cloudgoat\"," >> $TFVARS_FILE
9696
fi
9797
done
9898

cloudgoat/scenarios/aws/beanstalk_secrets/terraform/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ terraform {
77
required_providers {
88
aws = {
99
source = "hashicorp/aws"
10-
version = ">= 5.74.0"
10+
version = ">= 5.0.0"
1111
}
1212
}
1313
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1+
## This configures the minimum required Terraform and provider versions.
2+
## Configure the AWS profile and region specified in the variables as well as default tags.
3+
4+
terraform {
5+
required_version = ">= 1.5"
6+
7+
required_providers {
8+
aws = {
9+
source = "hashicorp/aws"
10+
version = ">= 5.0.0"
11+
}
12+
}
13+
}
14+
115
provider "aws" {
216
profile = var.profile
317
region = var.region
18+
19+
default_tags {
20+
tags = {
21+
Stack = var.stack-name
22+
Scenario = var.scenario-name
23+
}
24+
}
425
}

cloudgoat/scenarios/aws/cloud_breach_s3/terraform/versions.tf

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1+
## This configures the minimum required Terraform and provider versions.
2+
## Configure the AWS profile and region specified in the variables as well as default tags.
3+
4+
terraform {
5+
required_version = ">= 1.5"
6+
7+
required_providers {
8+
aws = {
9+
source = "hashicorp/aws"
10+
version = ">= 5.0.0"
11+
}
12+
}
13+
}
14+
115
provider "aws" {
2-
profile = "${var.profile}"
3-
region = "${var.region}"
4-
}
16+
profile = var.profile
17+
region = var.region
18+
19+
default_tags {
20+
tags = {
21+
Stack = var.stack-name
22+
Scenario = var.scenario-name
23+
}
24+
}
25+
}

cloudgoat/scenarios/aws/detection_evasion/terraform/provider.tf

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## This configures the minimum required Terraform and provider versions.
2+
## Configure the AWS profile and region specified in the variables as well as default tags.
3+
4+
terraform {
5+
required_version = ">= 1.5"
6+
7+
required_providers {
8+
aws = {
9+
source = "hashicorp/aws"
10+
version = ">= 5.0.0"
11+
}
12+
}
13+
}
14+
115
provider "aws" {
216
profile = var.profile
317
region = var.region
@@ -9,4 +23,4 @@ provider "aws" {
923
Scenario = var.scenario-name
1024
}
1125
}
12-
}
26+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1+
## This configures the minimum required Terraform and provider versions.
2+
## Configure the AWS profile and region specified in the variables as well as default tags.
3+
4+
terraform {
5+
required_version = ">= 1.5"
6+
7+
required_providers {
8+
aws = {
9+
source = "hashicorp/aws"
10+
version = ">= 5.0.0"
11+
}
12+
}
13+
}
14+
115
provider "aws" {
216
profile = var.profile
317
region = var.region
18+
19+
default_tags {
20+
tags = {
21+
Stack = var.stack-name
22+
Scenario = var.scenario-name
23+
}
24+
}
425
}

cloudgoat/scenarios/aws/ecs_takeover/terraform/provider.tf

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## This configures the minimum required Terraform and provider versions.
2+
## Configure the AWS profile and region specified in the variables as well as default tags.
3+
4+
terraform {
5+
required_version = ">= 1.5"
6+
7+
required_providers {
8+
aws = {
9+
source = "hashicorp/aws"
10+
version = ">= 5.0.0"
11+
}
12+
}
13+
}
14+
115
provider "aws" {
216
profile = var.profile
317
region = var.region
@@ -9,4 +23,4 @@ provider "aws" {
923
Scenario = var.scenario-name
1024
}
1125
}
12-
}
26+
}

cloudgoat/scenarios/aws/iam_privesc_by_attachment/terraform/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.2.0"
2+
required_version = ">= 1.5"
33

44
required_providers {
55
aws = {

cloudgoat/scenarios/aws/iam_privesc_by_ec2/terraform/provider.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
## This configures the minimum required Terraform and provider versions.
2+
## Configure the AWS profile and region specified in the variables as well as default tags.
3+
14
terraform {
25
required_version = ">= 1.5"
36

47
required_providers {
58
aws = {
69
source = "hashicorp/aws"
7-
version = ">= 5.61.0"
10+
version = ">= 5.0.0"
811
}
912
}
1013
}

0 commit comments

Comments
 (0)