Skip to content

Commit

Permalink
chore: some more changes to see cross refs
Browse files Browse the repository at this point in the history
  • Loading branch information
mishraomp committed Dec 8, 2024
1 parent 0c19311 commit fc486c1
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 14 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/.deployer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ on:
required: true
default: 'apply'
type: string
working_directory:
description: 'The working directory to run the command in'
required: true
default: 'database'
type: string




env:
TG_VERSION: 0.55.2
TF_VERSION: 1.5.3
TG_SRC_PATH: terraform/backend
TG_SRC_PATH: terraform/${{ inputs.working_directory }}
AWS_REGION: ca-central-1
jobs:
deploy_database:
Expand All @@ -42,12 +47,8 @@ jobs:
uses: autero1/action-terragrunt@v3
with:
terragrunt-version: ${{ env.TG_VERSION }}
- name: Print Terraform directory
working-directory: terraform/backend/${{ inputs.environment_name }}
run: |
ls -la
- name: Terragrunt Apply
working-directory: terraform/backend/${{ inputs.environment_name }}
working-directory: terraform/${{ inputs.working_directory }}/${{ inputs.environment_name }}
env:
target_env: ${{ inputs.environment_name }}
aws_license_plate: ${{ secrets.AWS_LICENSE_PLATE }}
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,22 @@ jobs:
# triggers: ('${{ matrix.package }}/')

# https://github.com/bcgov/quickstart-openshift-helpers
deploys:
name: Deploys
deploy-db:
name: Deploys Database
uses: ./.github/workflows/.deployer.yml
with:
environment_name: dev
command: apply
working_directory: database
secrets: inherit
deploy-api:
name: Deploys API
needs: [deploy-db]
uses: ./.github/workflows/.deployer.yml
with:
environment_name: dev
command: apply
working_directory: api
secrets: inherit


17 changes: 15 additions & 2 deletions infrastructure/api/ecs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
output "master_creds" {
value = data.aws_secretsmanager_secret.db-master-creds.secret_string
data "aws_secretsmanager_secret" "db_master_creds" {
name = "db-master-creds-${var.target_env}"
}



data "aws_rds_cluster" "rds_cluster" {
cluster_identifier = "qsawsc-aurora-cluster-${var.target_env}"
}

output "db_master_creds" {
value = data.aws_secretsmanager_secret.db_master_creds.secret_string
}
output "database_endpoint" {
value = data.aws_rds_cluster.rds_cluster.endpoint
}
4 changes: 4 additions & 0 deletions infrastructure/api/vars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "target_env" {
description = "AWS workload account env"
type = string
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ resource "aws_rds_cluster_parameter_group" "db_postgresql" {


resource "aws_secretsmanager_secret" "db_mastercreds_secret" {
name = "db-master-creds"
name = "db-master-creds-${var.target_env}"

tags = {
managed-by = "terraform"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion terraform/api/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ locals {
aws_license_plate = get_env("aws_license_plate")
statefile_bucket_name = "${local.tf_remote_state_prefix}-${local.aws_license_plate}-${local.target_env}"
statefile_key = "${local.target_env}/api/terraform.tfstate"
statelock_table_name = "${local.tf_remote_state_prefix}-lock-${local.aws_license_plate}-${local.target_env}-api"
statelock_table_name = "${local.tf_remote_state_prefix}-lock-${local.aws_license_plate}"
}

# Remote S3 state for Terraform.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
source = "../../..//infrastructure//backend"
source = "../../..//infrastructure//database"
}


Expand All @@ -12,7 +12,7 @@ locals {
target_env = get_env("target_env")
aws_license_plate = get_env("aws_license_plate")
statefile_bucket_name = "${local.tf_remote_state_prefix}-${local.aws_license_plate}-${local.target_env}"
statefile_key = "database/aurora-v2/terraform.tfstate"
statefile_key = "${local.target_env}/database/aurora-v2/terraform.tfstate"
statelock_table_name = "${local.tf_remote_state_prefix}-lock-${local.aws_license_plate}"
}

Expand Down

0 comments on commit fc486c1

Please sign in to comment.