Skip to content

Commit

Permalink
chore: Remove remaining modules from project, update workflows now th…
Browse files Browse the repository at this point in the history
…at modules are removed
  • Loading branch information
bryantbiggs committed Jul 24, 2023
1 parent c01ea01 commit ca8207f
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 591 deletions.
66 changes: 1 addition & 65 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ jobs:
- uses: dorny/paths-filter@v2
id: changes
with:
# We only need to check Terraform files for the current directory
# because the `preCommitMaxVersion` job will run the full,
# exhaustive checks (always)
filters: |
src:
- '${{ matrix.directory }}/*.tf'
Expand All @@ -87,71 +84,10 @@ jobs:
directory: ${{ matrix.directory }}

- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
uses: clowdhaus/terraform-composite-actions/[email protected]
# Run only validate pre-commit check on min version supported
if: ${{ matrix.directory != '.' && steps.changes.outputs.src== 'true' }}
with:
terraform-version: ${{ steps.minMax.outputs.minVersion }}
tflint-version: ${{ env.TFLINT_VERSION }}
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'

- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
uses: clowdhaus/terraform-composite-actions/[email protected]
# Run only validate pre-commit check on min version supported
if: ${{ matrix.directory == '.' && steps.changes.outputs.src== 'true' }}
with:
terraform-version: ${{ steps.minMax.outputs.minVersion }}
tflint-version: ${{ env.TFLINT_VERSION }}
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'

preCommitMaxVersion:
name: Max TF pre-commit
runs-on: ubuntu-latest
needs: collectInputs
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

- name: Remove default Terraform
run: rm -rf $(which terraform)

- name: Checkout
uses: actions/checkout@v3

- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- '**/*.tf'
- name: Config Terraform plugin cache
if: steps.changes.outputs.src== 'true'
run: mkdir --parents ${{ env.TERRAFORM_DOCS_VERSION }}

- name: Cache Terraform
uses: actions/cache@v3
if: steps.changes.outputs.src== 'true'
with:
path: ${{ env.TF_PLUGIN_CACHE_DIR }}
key: ${{ runner.os }}-terraform-${{ hashFiles('**/.terraform.lock.hcl') }}
restore-keys: ${{ runner.os }}-terraform-

- name: Install tfsec
if: steps.changes.outputs.src== 'true'
run: curl -sSLo ./tfsec https://github.com/aquasecurity/tfsec/releases/download/${{ env.TFSEC_VERSION }}/tfsec-$(uname)-amd64 && chmod +x tfsec && sudo mv tfsec /usr/bin/

- name: Terraform min/max versions
id: minMax
uses: clowdhaus/[email protected]
if: steps.changes.outputs.src== 'true'

- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}
uses: clowdhaus/terraform-composite-actions/[email protected]
if: steps.changes.outputs.src== 'true'
with:
terraform-version: ${{ steps.minMax.outputs.maxVersion }}
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}
tflint-version: ${{ env.TFLINT_VERSION }}
args: '--files ${{ matrix.directory }}/*'
11 changes: 5 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ repos:
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- id: terraform_validate
exclude: docs
# - id: terraform_tfsec
# files: ^examples/ # only scan `examples/*` which are the implementation
# args:
# - --args=--config-file=__GIT_WORKING_DIR__/tfsec.yaml
# - --args=--concise-output
exclude: (docs|modules)
- id: terraform_tfsec
args:
- --args=--config-file=__GIT_WORKING_DIR__/tfsec.yaml
- --args=--concise-output
40 changes: 11 additions & 29 deletions examples/fully-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,39 +77,21 @@ module "vpc" {
tags = local.tags
}

module "vpc_endpoints_sg" {
source = "terraform-aws-modules/security-group/aws"
version = "~> 5.0"

name = "${local.name}-vpc-endpoints"
description = "Security group for VPC endpoint access"
vpc_id = module.vpc.vpc_id

ingress_with_cidr_blocks = [
{
rule = "https-443-tcp"
description = "VPC CIDR HTTPS"
cidr_blocks = join(",", module.vpc.private_subnets_cidr_blocks)
},
]

egress_with_cidr_blocks = [
{
rule = "https-443-tcp"
description = "All egress HTTPS"
cidr_blocks = "0.0.0.0/0"
},
]

tags = local.tags
}

module "vpc_endpoints" {
source = "terraform-aws-modules/vpc/aws//modules/vpc-endpoints"
version = "~> 5.0"

vpc_id = module.vpc.vpc_id
security_group_ids = [module.vpc_endpoints_sg.security_group_id]
vpc_id = module.vpc.vpc_id

# Security group
create_security_group = true
security_group_name_prefix = "${local.name}-vpc-endpoints-"
security_group_rules = {
ingress_https = {
description = "HTTPS from VPC"
cidr_blocks = [module.vpc.private_subnets_cidr_blocks]
}
}

endpoints = merge({
s3 = {
Expand Down
75 changes: 0 additions & 75 deletions modules/irsa/README.md

This file was deleted.

91 changes: 0 additions & 91 deletions modules/irsa/main.tf

This file was deleted.

19 changes: 0 additions & 19 deletions modules/irsa/outputs.tf

This file was deleted.

Loading

0 comments on commit ca8207f

Please sign in to comment.