Skip to content

Commit

Permalink
fix: VPN Config (#3018)
Browse files Browse the repository at this point in the history
* Adding 1Pass to vpn config

* Install 1pass

* Service account token

* Conditional vault

* yep

* [review] vault

* debug

* TF version update

* export

* adding back error suppression
  • Loading branch information
ben851 authored Oct 3, 2024
1 parent 5fa4115 commit a757199
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 31 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/helmfile_production_apply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HELMFILE_FILE_PATH: ${{ github.workspace }}/helmfile
PRODUCTION_AWS_ACCOUNT: ${{ secrets.PRODUCTION_AWS_ACCOUNT }}
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.PRODUCTION_OP_SERVICE_ACCOUNT_TOKEN }}

jobs:
helmfile-apply:
Expand Down Expand Up @@ -51,10 +52,15 @@ jobs:
- name: Setup Terraform tools
uses: cds-snc/terraform-tools-setup@v1
env: # In case you want to override default versions
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.6.2
TERRAGRUNT_VERSION: 0.44.4
TF_SUMMARIZE_VERSION: 0.2.3
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.9.5
TERRAGRUNT_VERSION: 0.66.9
TF_SUMMARIZE_VERSION: 0.2.3

- name: Install 1Pass CLI
run: |
curl -o 1pass.deb https://downloads.1password.com/linux/debian/amd64/stable/1password-cli-amd64-latest.deb
sudo dpkg -i 1pass.deb
- name: Retrieve VPN Config
run: |
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/helmfile_production_plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ jobs:
install-helm: yes
helmfile-version: "v0.151.0"

- name: Install 1Pass CLI
run: |
curl -o 1pass.deb https://downloads.1password.com/linux/debian/amd64/stable/1password-cli-amd64-latest.deb
sudo dpkg -i 1pass.deb
- name: Install OpenVPN
run: |
sudo apt update
Expand All @@ -52,10 +57,10 @@ jobs:
- name: Setup Terraform tools
uses: cds-snc/terraform-tools-setup@v1
env: # In case you want to override default versions
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.6.2
TERRAGRUNT_VERSION: 0.44.4
TF_SUMMARIZE_VERSION: 0.2.3
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.9.5
TERRAGRUNT_VERSION: 0.66.9
TF_SUMMARIZE_VERSION: 0.2.3

- name: Retrieve VPN Config
run: |
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/helmfile_staging_apply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HELMFILE_FILE_PATH: ${{ github.workspace }}/helmfile
STAGING_AWS_ACCOUNT: ${{ secrets.STAGING_AWS_ACCOUNT }}
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}

jobs:
helmfile-apply:
Expand Down Expand Up @@ -46,13 +47,18 @@ jobs:
sudo apt update
sudo apt install -y openvpn openvpn-systemd-resolved
- name: Install 1Pass CLI
run: |
curl -o 1pass.deb https://downloads.1password.com/linux/debian/amd64/stable/1password-cli-amd64-latest.deb
sudo dpkg -i 1pass.deb
- name: Setup Terraform tools
uses: cds-snc/terraform-tools-setup@v1
env: # In case you want to override default versions
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.6.2
TERRAGRUNT_VERSION: 0.44.4
TF_SUMMARIZE_VERSION: 0.2.3
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.9.5
TERRAGRUNT_VERSION: 0.66.9
TF_SUMMARIZE_VERSION: 0.2.3

- name: Retrieve VPN Config
run: |
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/helmfile_staging_apply_specific_app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ env:
HELMFILE_FILE_PATH: ${{ github.workspace }}/helmfile
STAGING_AWS_ACCOUNT: ${{ secrets.STAGING_AWS_ACCOUNT }}
DOCKER_TAG: ${{ github.event.inputs.tag }}
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}

jobs:
rollout:
Expand Down Expand Up @@ -67,10 +68,15 @@ jobs:
- name: Setup Terraform tools
uses: cds-snc/terraform-tools-setup@v1
env: # In case you want to override default versions
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.6.2
TERRAGRUNT_VERSION: 0.44.4
TF_SUMMARIZE_VERSION: 0.2.3
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.9.5
TERRAGRUNT_VERSION: 0.66.9
TF_SUMMARIZE_VERSION: 0.2.3

- name: Install 1Pass CLI
run: |
curl -o 1pass.deb https://downloads.1password.com/linux/debian/amd64/stable/1password-cli-amd64-latest.deb
sudo dpkg -i 1pass.deb
- name: Retrieve VPN Config
run: |
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/helmfile_staging_plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HELMFILE_FILE_PATH: ${{ github.workspace }}/helmfile
STAGING_AWS_ACCOUNT: ${{ secrets.STAGING_AWS_ACCOUNT }}

OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}


jobs:
helmfile-diff:
Expand Down Expand Up @@ -38,14 +39,19 @@ jobs:
sudo apt update
sudo apt install -y openvpn openvpn-systemd-resolved
- name: Install 1Pass CLI
run: |
curl -o 1pass.deb https://downloads.1password.com/linux/debian/amd64/stable/1password-cli-amd64-latest.deb
sudo dpkg -i 1pass.deb
- name: Setup Terraform tools
uses: cds-snc/terraform-tools-setup@v1
env: # In case you want to override default versions
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.6.2
TERRAGRUNT_VERSION: 0.44.4
TF_SUMMARIZE_VERSION: 0.2.3

CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.9.5
TERRAGRUNT_VERSION: 0.66.9
TF_SUMMARIZE_VERSION: 0.2.3
- name: Retrieve VPN Config
run: |
scripts/createVPNConfig.sh staging 2> /dev/null
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/merge_to_main_production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,15 @@ jobs:
- name: Setup Terraform tools
uses: cds-snc/terraform-tools-setup@v1
env: # In case you want to override default versions
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.6.2
TERRAGRUNT_VERSION: 0.44.4
TF_SUMMARIZE_VERSION: 0.2.3
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.9.5
TERRAGRUNT_VERSION: 0.66.9
TF_SUMMARIZE_VERSION: 0.2.3

- name: Install 1Pass CLI
run: |
curl -o 1pass.deb https://downloads.1password.com/linux/debian/amd64/stable/1password-cli-amd64-latest.deb
sudo dpkg -i 1pass.deb
- name: Retrieve VPN Config
run: |
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/merge_to_main_staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@ jobs:
- name: Setup Terraform tools
uses: cds-snc/terraform-tools-setup@v1
env: # In case you want to override default versions
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.6.2
TERRAGRUNT_VERSION: 0.44.4
TF_SUMMARIZE_VERSION: 0.2.3
CONFTEST_VERSION: 0.30.0
TERRAFORM_VERSION: 1.9.5
TERRAGRUNT_VERSION: 0.66.9
TF_SUMMARIZE_VERSION: 0.2.3

- name: Install 1Pass CLI
run: |
curl -o 1pass.deb https://downloads.1password.com/linux/debian/amd64/stable/1password-cli-amd64-latest.deb
sudo dpkg -i 1pass.deb
- name: Retrieve VPN Config
run: |
Expand Down
8 changes: 7 additions & 1 deletion scripts/createVPNConfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
# This script will create a VPN configuration file for the specified environment
# Usage: ./createVPNConfig.sh <environment>
# Example: ./createVPNConfig.sh staging
ENVIRONMENT=$1
export ENVIRONMENT=$1
if [ "$ENVIRONMENT" == "production" ]; then
VAULT=ppnxsriom3alsxj4ogikyjxlzi
else
VAULT=4eyyuwddp6w4vxlabrr2i2duxm
fi
git clone https://github.com/cds-snc/notification-terraform.git /var/tmp/notification-terraform
op read op://$VAULT/"TFVars - $ENVIRONMENT"/notesPlain > /var/tmp/notification-terraform/aws/$ENVIRONMENT.tfvars
cd /var/tmp/notification-terraform/env/$ENVIRONMENT/eks
export INFRASTRUCTURE_VERSION=$(cat ../../../.github/workflows/infrastructure_version.txt)
ENDPOINT_ID=$(terragrunt output --raw gha_vpn_id)
Expand Down

0 comments on commit a757199

Please sign in to comment.