Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 198 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
name: CI

on:
pull_request:
branches: [main]
push:
branches: [main]

jobs:
terraform-validation:
name: Terraform Validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3

- name: Terraform Format Check
id: fmt
run: terraform fmt -check -recursive operations/deployment/terraform/aws/
continue-on-error: true

- name: Terraform Format Check
id: modules
run: terraform fmt -check -recursive operations/deployment/terraform/modules/
continue-on-error: true

- name: Create mock provider.tf
run: |
cat > operations/deployment/terraform/aws/provider.tf << 'EOF'
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
random = {
source = "hashicorp/random"
version = ">= 2.2"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.22"
}
}
}

provider "aws" {
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "ec2"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "r53"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "elb"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "efs"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "vpc"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "rds"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "aurora"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "ecs"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "db_proxy"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "redis"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "eks"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "ecr"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "aws" {
alias = "waf"
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}

provider "kubernetes" {
alias = "eks"
host = null
cluster_ca_certificate = null
token = null
}
EOF

- name: Create mock terraform.tfvars
run: |
cat > operations/deployment/terraform/aws/terraform.tfvars << 'EOF'
aws_resource_identifier = "test-repo-branch"
aws_resource_identifier_supershort = "test-repo-branch"
app_repo_name = "test-repo"
app_org_name = "test-org"
app_branch_name = "test-branch"
ops_repo_environment = "deployment"
app_install_root = "/home/ubuntu"
EOF

- name: Terraform Init
id: init
run: terraform -chdir=operations/deployment/terraform/aws/ init -backend=false

- name: Terraform Validate
id: validate
run: terraform -chdir=operations/deployment/terraform/aws/ validate

- name: Comment Format Check Result
if: always() && steps.fmt.outcome == 'failure' && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '⚠️ Terraform formatting issues detected. Run `terraform fmt -recursive operations/deployment/terraform/aws/` to fix.'
})
20 changes: 10 additions & 10 deletions operations/deployment/terraform/aws/aws_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ variable "aws_ec2_port_list" {
default = ""
}

variable "aws_ec2_user_data_replace_on_change" {
variable "aws_ec2_user_data_replace_on_change" {
type = bool
description = "Forces destruction of EC2 instance"
default = true
Expand All @@ -145,21 +145,21 @@ variable "aws_vpc_create" {
}

variable "aws_vpc_name" {
type = string
type = string
description = "Name for the aws vpc"
default = ""
default = ""
}

variable "aws_vpc_id" {
type = string
type = string
description = "aws vpc id"
default = ""
default = ""
}

variable "aws_vpc_subnet_id" {
type = string
type = string
description = "aws vpc subnet id"
default = ""
default = ""
}

variable "aws_vpc_cidr_block" {
Expand Down Expand Up @@ -1602,13 +1602,13 @@ variable "aws_ecs_additional_tags" {
}

# ECR
variable "aws_ecr_repo_create" {
variable "aws_ecr_repo_create" {
description = "Determines whether a repository will be created"
type = bool
default = false
}

variable "aws_ecr_repo_type" {
variable "aws_ecr_repo_type" {
description = "The type of repository to create. Either `public` or `private`"
type = string
default = "private"
Expand Down Expand Up @@ -1736,7 +1736,7 @@ variable "aws_ecr_public_repo_catalog" {
default = {}
}

variable "aws_ecr_registry_policy_input" {
variable "aws_ecr_registry_policy_input" {
description = "The policy document. This is a JSON formatted string"
type = string
default = ""
Expand Down
Loading