Skip to content

Commit

Permalink
Merge pull request #99 from vivid-cpreston/feature/wfdm894
Browse files Browse the repository at this point in the history
Feature/wfdm894
  • Loading branch information
vivid-cpreston authored Oct 18, 2023
2 parents 71b8d7c + 0ba7d6c commit 249e691
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 57 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/deploy_dlv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,17 @@ jobs:
openssl sha256 staging/wfdm-file-index-initializer* > staging/wfdm-file-index-initializer-hash.txt
openssl sha256 staging/wfdm-opensearch-indexing* > staging/wfdm-opensearch-indexing-hash.txt
- uses: shallwefootball/s3-upload-action@master
name: Upload S3
id: S3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws_bucket: wfdm-s3-bucket-${{ env.TARGET_ENV }}
source_dir: staging
destination_dir: ''
role-to-assume: ${{ secrets.AWS_TERRAFORM_ROLE_TO_ASSUME }}
role-session-name: wfdm-terraform
aws-region: ca-central-1

- name: Upload S3
id: S3
run:
aws s3 cp ./staging s3://wfdm-s3-bucket-dlv --recursive

# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/deploy_prd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,17 @@ jobs:
openssl sha256 staging/wfdm-file-index-initializer* > staging/wfdm-file-index-initializer-hash.txt
openssl sha256 staging/wfdm-opensearch-indexing* > staging/wfdm-opensearch-indexing-hash.txt
- uses: shallwefootball/s3-upload-action@master
name: Upload S3
id: S3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws_bucket: wfdm-s3-bucket-${{ env.TARGET_ENV }}
source_dir: staging
destination_dir: ''
role-to-assume: ${{ secrets.AWS_TERRAFORM_ROLE_TO_ASSUME }}
role-session-name: wfdm-terraform
aws-region: ca-central-1

- name: Upload S3
id: S3
run:
aws s3 cp ./staging s3://wfdm-s3-bucket-prd --recursive

# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/deploy_tst.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,17 @@ jobs:
openssl sha256 staging/wfdm-file-index-initializer* > staging/wfdm-file-index-initializer-hash.txt
openssl sha256 staging/wfdm-opensearch-indexing* > staging/wfdm-opensearch-indexing-hash.txt
- uses: shallwefootball/s3-upload-action@master
name: Upload S3
id: S3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws_bucket: wfdm-s3-bucket-${{ env.TARGET_ENV }}
source_dir: staging
destination_dir: ''
role-to-assume: ${{ secrets.AWS_TERRAFORM_ROLE_TO_ASSUME }}
role-session-name: wfdm-terraform
aws-region: ca-central-1

- name: Upload S3
id: S3
run:
aws s3 cp ./staging s3://wfdm-s3-bucket-tst --recursive

# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
Expand Down
1 change: 0 additions & 1 deletion terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ terraform {
required_version = ">= 1.1.0"
}


data "aws_vpc" "main_vpc" {
id = var.vpc_id
}
Expand Down
3 changes: 3 additions & 0 deletions terragrunt/DEV/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,8 @@ generate "inputs" {
document_token_url = "${local.document_token_url}"
clamQueue = "${local.clamstackQueue}"
secret_manager_name = "WFDM_DOC_INDEX_ACCOUNT_PASSWORD_${local.target_env}"
opensearch_user = "${local.opensearch_user}"
opensearch_password = "${local.opensearch_password}"
ElasticSearch_Version = "OpenSearch_2.5"
EOF
}
16 changes: 6 additions & 10 deletions terragrunt/DLV/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,17 @@ generate "backend" {
if_exists = "overwrite_terragrunt"
contents = <<EOF
terraform {
backend "remote" {
organization = "wf1-wfdm-opensearch"
workspaces {
name = "nr-bcws-opensearch-DLV"
}
backend "s3" {
bucket = "wfdm-terraform-remote-state-dlv"
key = "wfdm-opensearch-statefile-dlv"
region = "ca-central-1"
dynamodb_table = "wfdm-remote-state-lock-dlv"
encrypt = true
}
}
EOF
}

remote_state {
backend = "remote"
config = { }
}

generate "inputs" {
path = "terraform.auto.tfvars"
if_exists = "overwrite_terragrunt"
Expand Down
1 change: 0 additions & 1 deletion terragrunt/INT/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ locals {
clamstackQueue = "WfdmClamavStackINT-wfdmClamscanQueueintC7DDA541-4i0O18IjJgs0"
opensearch_password = get_env("opensearch_password")
opensearch_user = get_env("opensearch_user")

}

generate "backend" {
Expand Down
22 changes: 11 additions & 11 deletions terragrunt/PRD/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,26 @@ locals {
document_token_url = "https://apps.nrs.gov.bc.ca/pub/oauth2/v1/oauth/token?disableDeveloperFilter=true&grant_type=client_credentials"
clamAVStackName = "WfdmClamavStackPRD"
clamstackQueue = "WfdmClamavStackPRD-wfdmClamscanQueueprdBFC4209A-SB0Y4rvaR7PT"

opensearch_password = get_env("opensearch_password")
opensearch_user = get_env("opensearch_user")
}

generate "backend" {
path = "backend.tf"
if_exists = "overwrite_terragrunt"
contents = <<EOF
terraform {
backend "remote" {
organization = "wf1-wfdm-opensearch"
workspaces {
name = "nr-bcws-opensearch-prd"
}
backend "s3" {
bucket = "wfdm-terraform-remote-state-prd"
key = "wfdm-opensearch-statefile-prd"
region = "ca-central-1"
dynamodb_table = "wfdm-remote-state-lock-prd"
encrypt = true
}
}
EOF
}

remote_state {
backend = "remote"
config = { }
}

generate "inputs" {
path = "terraform.auto.tfvars"
if_exists = "overwrite_terragrunt"
Expand All @@ -50,5 +47,8 @@ generate "inputs" {
document_token_url = "${local.document_token_url}"
clamQueue = "${local.clamstackQueue}"
secret_manager_name = "WFDM_DOC_INDEX_ACCOUNT_PASSWORD_${local.target_env}"
opensearch_user = "${local.opensearch_user}"
opensearch_password = "${local.opensearch_password}"
ElasticSearch_Version = "OpenSearch_2.5"
EOF
}
16 changes: 6 additions & 10 deletions terragrunt/TST/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,17 @@ generate "backend" {
if_exists = "overwrite_terragrunt"
contents = <<EOF
terraform {
backend "remote" {
organization = "wf1-wfdm-opensearch"
workspaces {
name = "nr-bcws-opensearch-tst"
}
backend "s3" {
bucket = "wfdm-terraform-remote-state-tst"
key = "wfdm-opensearch-statefile-tst"
region = "ca-central-1"
dynamodb_table = "wfdm-remote-state-lock-tst"
encrypt = true
}
}
EOF
}

remote_state {
backend = "remote"
config = { }
}

generate "inputs" {
path = "terraform.auto.tfvars"
if_exists = "overwrite_terragrunt"
Expand Down

0 comments on commit 249e691

Please sign in to comment.