Skip to content

Commit

Permalink
chore: Update CI and examples for Terraform (#1619)
Browse files Browse the repository at this point in the history
* chore: Update Ci and examples for Terraform

- upgrade terraform versions
- replaced philips vpc module by aws-terraform-vpc module
- dropped support for terrform pre 1.x from examples

* chore: Update Ci and examples for Terraform

- upgrade terraform versions
- replaced philips vpc module by aws-terraform-vpc module
- dropped support for terrform pre 1.x from examples

- upgrade terraform versions
- replaced philips vpc module by aws-terraform-vpc module
- dropped support for terrform pre 1.x from examples

replace local by var ref

* check formatting for latest terraform version

* fix formatting

* fix formatting

* fix formatting
  • Loading branch information
npalm authored Jan 28, 2022
1 parent 39c019c commit db4fc4b
Show file tree
Hide file tree
Showing 18 changed files with 246 additions and 109 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ on:
- "modules/*/lambdas/**"

env:
tf_version: "1.0."
tf_working_dir: "."
AWS_REGION: eu-west-1
jobs:
verify_module:
name: Verify module
strategy:
matrix:
terraform: [1.0.8]
terraform: [1.1.3, 'latest']
runs-on: ubuntu-latest
container:
image: hashicorp/terraform:${{ matrix.terraform }}
Expand All @@ -31,7 +29,11 @@ jobs:
touch modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/runner-binaries-syncer.zip
- name: terraform init
run: terraform init -get -backend=false -input=false
- name: check terraform formatting
- if: contains(matrix.terraform, '1.1.')
name: check terraform formatting
run: terraform fmt -recursive -check=true -write=false
- if: contains(matrix.terraform, 'latest') # check formatting for the latest release but avoid failing the build
name: check terraform formatting
run: terraform fmt -recursive -check=true -write=false
continue-on-error: true
- name: validate terraform
Expand All @@ -42,7 +44,7 @@ jobs:
strategy:
fail-fast: false
matrix:
terraform: [0.14.3, 0.15.5, 1.0.8]
terraform: [1.0.11, 1.1.3, 'latest']
example: ["default", "ubuntu", "prebuilt", "arm64", "ephemeral", "windows"]
defaults:
run:
Expand All @@ -54,9 +56,12 @@ jobs:
- uses: actions/checkout@v2
- name: terraform init
run: terraform init -get -backend=false -input=false
- if: contains(matrix.terraform, '1.0.')
- if: contains(matrix.terraform, '1.1.')
name: check terraform formatting
run: terraform fmt -recursive -check=true -write=false
- if: contains(matrix.terraform, 'latest') # check formatting for the latest release but avoid failing the build
name: check terraform formatting
run: terraform fmt -recursive -check=true -write=false
continue-on-error: true
- name: validate terraform
- name: validate terraform011
run: terraform validate
2 changes: 1 addition & 1 deletion examples/arm64/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module "runners" {

enable_organization_runners = false
# Runners will automatically get the "arm64" label
runner_extra_labels = "default,example"
runner_extra_labels = "default,example"

# enable access to the runners via SSM
enable_ssm_on_runners = true
Expand Down
28 changes: 14 additions & 14 deletions examples/default/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/default/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.27"
version = ">= 3.71"
}
local = {
source = "hashicorp/local"
Expand All @@ -11,5 +11,5 @@ terraform {
source = "hashicorp/random"
}
}
required_version = ">= 0.14"
required_version = ">= 1"
}
22 changes: 18 additions & 4 deletions examples/default/vpc.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
module "vpc" {
source = "git::https://github.com/philips-software/terraform-aws-vpc.git?ref=2.2.0"
source = "terraform-aws-modules/vpc/aws"
version = "3.11.2"

name = "vpc-${local.environment}"
cidr = "10.0.0.0/16"

azs = ["${local.aws_region}a", "${local.aws_region}b", "${local.aws_region}c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]

enable_dns_hostnames = true
enable_nat_gateway = true
map_public_ip_on_launch = false
single_nat_gateway = true

tags = {
Environment = local.environment
}

environment = local.environment
aws_region = local.aws_region
create_private_hosted_zone = false
}
28 changes: 14 additions & 14 deletions examples/ephemeral/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/ephemeral/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.27"
version = ">= 3.71"
}
local = {
source = "hashicorp/local"
Expand All @@ -11,5 +11,5 @@ terraform {
source = "hashicorp/random"
}
}
required_version = ">= 0.14"
required_version = ">= 1"
}
22 changes: 18 additions & 4 deletions examples/ephemeral/vpc.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
module "vpc" {
source = "git::https://github.com/philips-software/terraform-aws-vpc.git?ref=2.2.0"
source = "terraform-aws-modules/vpc/aws"
version = "3.11.2"

name = "vpc-${local.environment}"
cidr = "10.0.0.0/16"

azs = ["${local.aws_region}a", "${local.aws_region}b", "${local.aws_region}c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]

enable_dns_hostnames = true
enable_nat_gateway = true
map_public_ip_on_launch = false
single_nat_gateway = true

tags = {
Environment = local.environment
}

environment = local.environment
aws_region = local.aws_region
create_private_hosted_zone = false
}
22 changes: 18 additions & 4 deletions examples/permissions-boundary/vpc.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
module "vpc" {
source = "git::https://github.com/philips-software/terraform-aws-vpc.git?ref=2.1.0"
source = "terraform-aws-modules/vpc/aws"
version = "3.11.2"

name = "vpc-${local.environment}"
cidr = "10.0.0.0/16"

azs = ["${local.aws_region}a", "${local.aws_region}b", "${local.aws_region}c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]

enable_dns_hostnames = true
enable_nat_gateway = true
map_public_ip_on_launch = false
single_nat_gateway = true

tags = {
Environment = local.environment
}

environment = local.environment
aws_region = local.aws_region
create_private_hosted_zone = false
}
29 changes: 14 additions & 15 deletions examples/prebuilt/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/prebuilt/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.27"
version = ">= 3.71"
}
local = {
source = "hashicorp/local"
Expand All @@ -11,5 +11,5 @@ terraform {
source = "hashicorp/random"
}
}
required_version = ">= 0.14"
required_version = ">= 1"
}
22 changes: 18 additions & 4 deletions examples/prebuilt/vpc.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
module "vpc" {
source = "git::https://github.com/philips-software/terraform-aws-vpc.git?ref=2.2.0"
source = "terraform-aws-modules/vpc/aws"
version = "3.11.2"

name = "vpc-${local.environment}"
cidr = "10.0.0.0/16"

azs = ["${var.aws_region}a", "${var.aws_region}b", "${var.aws_region}c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]

enable_dns_hostnames = true
enable_nat_gateway = true
map_public_ip_on_launch = false
single_nat_gateway = true

tags = {
Environment = local.environment
}

environment = local.environment
aws_region = var.aws_region
create_private_hosted_zone = false
}
28 changes: 14 additions & 14 deletions examples/ubuntu/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions examples/ubuntu/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.71"
}
local = {
source = "hashicorp/local"
}
random = {
source = "hashicorp/random"
}
}
required_version = ">= 1"
}
Loading

0 comments on commit db4fc4b

Please sign in to comment.