Skip to content

Commit

Permalink
Merge pull request #28 from ADORSYS-GIS/fix/terraform-deployment
Browse files Browse the repository at this point in the history
feat: added dev.tfvars for deploy.yaml
  • Loading branch information
Arielpetit authored Dec 11, 2024
2 parents 41eb090 + a15d8b1 commit 088a5be
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 69 deletions.
39 changes: 16 additions & 23 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: Terraform Deployment

on:

workflow_dispatch:
push:
branches:
- deploy
push: null
pull_request: null

defaults:
run:
Expand Down Expand Up @@ -46,14 +44,13 @@ jobs:
name: Deploy to ${{ matrix.name }} Environment
environment:
name: ${{ matrix.name }}
url: https://${{ env.DOMAIN_NAME }}
url: https://${{ vars.DOMAIN_NAME }}
strategy:
matrix:
env:
name:
- dev
include:
- env: dev
name: development
- name: dev
description: "Deploy to Dev Environment"

steps:
Expand All @@ -70,30 +67,26 @@ jobs:
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
aws-region: ${{ vars.AWS_REGION }}

- name: Set DB Password and Username as Environment Variables
run: |
echo "TF_VAR_name=${{ matrix.env }}-cluster" >> $GITHUB_ENV
echo "TF_VAR_db_username=${{ env.DB_USERNAME }}" >> $GITHUB_ENV
echo "TF_VAR_name=${{ matrix.name }}-cluster" >> $GITHUB_ENV
echo "TF_VAR_db_username=${{ vars.DB_USERNAME }}" >> $GITHUB_ENV
echo "TF_VAR_db_password=${{ secrets.DB_PASSWORD }}" >> $GITHUB_ENV
echo "TF_VAR_oidc_kc_client_id=${{ env.OIDC_KC_CLIENT_ID }}" >> $GITHUB_ENV
echo "TF_VAR_oidc_kc_client_id=${{ vars.OIDC_KC_CLIENT_ID }}" >> $GITHUB_ENV
echo "TF_VAR_oidc_kc_client_secret=${{ secrets.OIDC_KC_CLIENT_SECRET }}" >> $GITHUB_ENV
echo "TF_VAR_oidc_kc_issuer_url=${{ env.OIDC_KC_ISSUER_URL }}" >> $GITHUB_ENV
echo "TF_VAR_cert_arn=${{ env.CERT_ARN }}" >> $GITHUB_ENV
echo "TF_VAR_region=${{ env.AWS_REGION }}" >> $GITHUB_ENV
echo "TF_VAR_azs=${{ env.AWS_AVAILABLE_ZONES }}" >> $GITHUB_ENV
echo "TF_VAR_zone_name=${{ env.DOMAIN_NAME }}" >> $GITHUB_ENV
echo "TF_VAR_oidc_kc_issuer_url=${{ vars.OIDC_KC_ISSUER_URL }}" >> $GITHUB_ENV
echo "TF_VAR_cert_arn=${{ vars.CERT_ARN }}" >> $GITHUB_ENV
echo "TF_VAR_region=${{ vars.AWS_REGION }}" >> $GITHUB_ENV
echo "TF_VAR_zone_name=${{ vars.DOMAIN_NAME }}" >> $GITHUB_ENV
- name: Terraform Init
run: terraform init -var-file=${{ matrix.env }}.tfvars

- name: Terraform Validate
run: terraform validate -var-file=${{ matrix.env }}.tfvars
run: terraform init -var-file=${{ matrix.name }}.tfvars

- name: Terraform Plan
run: terraform plan -var-file=${{ matrix.env }}.tfvars -out=plan.tfplan
run: terraform plan -var-file=${{ matrix.name }}.tfvars -out=plan.tfplan

- name: Terraform Apply
if: github.event_name == 'workflow_dispatch'
run: terraform apply -auto-approve plan.tfplan
run: terraform apply -auto-approve plan.tfplan
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
# Crash log files
crash.log

# Exclude all .tfvars files, which are likely to contain sentitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
Expand All @@ -28,4 +22,6 @@ terraform.rc

charts/*/charts

.idea
.idea

*local*.tfvars
70 changes: 31 additions & 39 deletions terraform/.terraform.lock.hcl

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

18 changes: 18 additions & 0 deletions terraform/dev.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
vpc_cidr = "12.34.0.0/16"
environment = "dev"
eks_min_instance = 1
eks_max_instance = 3
eks_desired_instance = 2
db_instance = "db.t3.medium"
db_backup_retention_period = null
db_skip_final_snapshot = true
eks_ec2_instance_types = [
"t2.nano",
"t2.medium",
"t2.large"
]
azs = [
"eu-central-1a",
"eu-central-1b",
"eu-central-1c"
]

0 comments on commit 088a5be

Please sign in to comment.