Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.terraform*
DS_Store
.DS_Store
60 changes: 60 additions & 0 deletions terraform/.github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "Vprofile IAC"
on:
push:
branches:
- main
- stage
paths:
- terraform/**
pull_request:
branches:
- main
paths:
- terraform/**

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BUCKET_TF_STATE: ${{ secrets.BUCKET_TF_STATE }}
AWS_REGION: us-east-1
EKS_CLUSTER: vprofile-eks

job:
terraform:
name: "APPLY terraform code changes"
runs on: ubuntu-latest
defaults:
run:
shell:
working-directory: ./terraform

steps:
- name: checkout source code
uses: actions/checkout@v4

- name: setup terraform with specified version
uses: actions/checkout@v2
#with:
# terraform_version 1.6.3

- name: terraform init
id: init
run: terraform init -backend-config="bucket=$BUCKET_TF_STATE"

- name: terraform format
id: fmt
run: terrform fmt -check

- name: terraform validate
id: validate
run: terrform validate

- name: terraform plan
id: plan
run: terraform plan -no-color -input=false -out planfile
continue-on-error: true

- name: terraform plan status
if: steps.plan.outcome == 'failure'
run: exit 1
#####
4 changes: 2 additions & 2 deletions terraform/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ terraform {
}

backend "s3" {
bucket = "gitopsterrastate"
bucket = "tf-gitops"
key = "terraform.tfstate"
region = "us-east-2"
region = "us-east-1"
}

required_version = "~> 1.6.3"
Expand Down
4 changes: 2 additions & 2 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
variable "region" {
description = "AWS region"
type = string
default = "us-east-2"
default = "us-east-1"
}

variable "clusterName" {
description = "Name of the EKS cluster"
type = string
default = "kitops-eks"
default = "vprofile-eks"
}
1 change: 1 addition & 0 deletions terraform/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ module "vpc" {
"kubernetes.io/role/internal-elb" = 1
}
}
#####