Skip to content

Commit

Permalink
Merge pull request #389 from systemaccounting/388-infra-dir-name
Browse files Browse the repository at this point in the history
388 abbreviate infrastructure directory name
  • Loading branch information
mxfactorial authored Sep 27, 2024
2 parents 9673221 + ff01ccd commit 1a956c3
Show file tree
Hide file tree
Showing 109 changed files with 127 additions and 127 deletions.
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
**/*.backup
**/*lock.info
**/.terraform/
infrastructure/terraform/env-id/.terraform.*
infrastructure/terraform/aws/environments/region/.terraform*
infrastructure/terraform/aws/environments/init-dev/.terraform*
infrastructure/terraform/aws/environments/dev/.terraform*
infra/terraform/env-id/.terraform.*
infra/terraform/aws/environments/region/.terraform*
infra/terraform/aws/environments/init-dev/.terraform*
infra/terraform/aws/environments/dev/.terraform*

## linux
nohup.out
Expand Down Expand Up @@ -53,8 +53,8 @@ services/**/bootstrap
# aws-cdk
.cdk.staging
cdk.out
infrastructure/aws-cdk/**/*.js
infrastructure/aws-cdk/**/*.d.ts
infra/aws-cdk/**/*.js
infra/aws-cdk/**/*.d.ts

# ipython
.ipynb_checkpoints
Expand Down
8 changes: 4 additions & 4 deletions client/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ APP_NAME=$(shell basename $(CURDIR))
RELATIVE_PROJECT_ROOT_PATH=..
PROJECT_CONF_FILE_NAME=project.yaml
PROJECT_CONF=$(RELATIVE_PROJECT_ROOT_PATH)/$(PROJECT_CONF_FILE_NAME)
CLIENT_ORIGIN_BUCKET_PREFIX=$(shell yq '.infrastructure.terraform.aws.modules["project-storage"].env_var.set.CLIENT_ORIGIN_BUCKET_PREFIX.default' $(PROJECT_CONF))
CLIENT_ORIGIN_BUCKET_PREFIX=$(shell yq '.infra.terraform.aws.modules["project-storage"].env_var.set.CLIENT_ORIGIN_BUCKET_PREFIX.default' $(PROJECT_CONF))
ENV_ID=$(shell (cd $(RELATIVE_PROJECT_ROOT_PATH); ENV=$(ENV) PROJECT_CONF=$(PROJECT_CONF_FILE_NAME) . ./scripts/print-env-id.sh))
ORIGIN_BUCKET=$(CLIENT_ORIGIN_BUCKET_PREFIX)-$(ENV_ID)-$(ENV)
ENABLE_API_AUTH=$(shell yq '.infrastructure.terraform.aws.modules.environment.env_var.set.ENABLE_API_AUTH.default' $(PROJECT_CONF))
SSM_VERSION=$(shell yq '.infrastructure.terraform.aws.modules.environment.env_var.set.SSM_VERSION.default' $(PROJECT_CONF))
ENABLE_API_AUTH=$(shell yq '.infra.terraform.aws.modules.environment.env_var.set.ENABLE_API_AUTH.default' $(PROJECT_CONF))
SSM_VERSION=$(shell yq '.infra.terraform.aws.modules.environment.env_var.set.SSM_VERSION.default' $(PROJECT_CONF))
CLOUDFRONT_QUERY=Invalidation.{Status:Status,CreateTime:CreateTime}
BUILD_DIR=$(CURDIR)/build
DEPS_DIR=$(CURDIR)/node_modules
REGION=$(shell yq '.infrastructure.terraform.aws.modules.environment.env_var.set.REGION.default' $(PROJECT_CONF))
REGION=$(shell yq '.infra.terraform.aws.modules.environment.env_var.set.REGION.default' $(PROJECT_CONF))
ENV_FILE_NAME=$(shell yq '.env_var.set.ENV_FILE_NAME.default' $(PROJECT_CONF))
ENV_FILE=$(CURDIR)/$(ENV_FILE_NAME)
LOCAL_ADDRESS=$(shell yq '.env_var.set.LOCAL_ADDRESS.default' $(PROJECT_CONF))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ locals {
ENV = "dev"
APP_ENV = "${local.APP}-${local.ENV}"
PROJECT_CONF = yamldecode(file("../../../../../project.yaml"))
STORAGE_ENV_VAR = local.PROJECT_CONF.infrastructure.terraform.aws.modules.project-storage.env_var.set
STORAGE_ENV_VAR = local.PROJECT_CONF.infra.terraform.aws.modules.project-storage.env_var.set
ORIGIN_PREFIX = local.STORAGE_ENV_VAR.CLIENT_ORIGIN_BUCKET_PREFIX.default
ARTIFACTS_PREFIX = local.STORAGE_ENV_VAR.ARTIFACTS_BUCKET_PREFIX.default
TFSTATE_PREFIX = local.STORAGE_ENV_VAR.TFSTATE_BUCKET_PREFIX.default
INFRA_ENV_VAR = local.PROJECT_CONF.infrastructure.terraform.aws.modules.environment.env_var.set
INFRA_ENV_VAR = local.PROJECT_CONF.infra.terraform.aws.modules.environment.env_var.set
RDS_PREFIX = local.INFRA_ENV_VAR.RDS_PREFIX.default
REGION = local.INFRA_ENV_VAR.REGION.default
ENV_ID = module.env_id.ENV_ID
Expand Down Expand Up @@ -74,7 +74,7 @@ module "dev" {
enable_api_auto_deploy = true

############### k8s ###############

microk8s_instance_type = "t2.medium"
enable_microk8s = false

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
RELATIVE_PROJECT_ROOT_PATH=../../../../..
PROJECT_CONF_FILE_NAME=project.yaml
PROJECT_CONF=$(RELATIVE_PROJECT_ROOT_PATH)/$(PROJECT_CONF_FILE_NAME)
TFSTATE_ENV_SUFFIX=$(shell yq '.infrastructure.terraform.env_var.set.TFSTATE_ENV_SUFFIX.default' $(PROJECT_CONF))
TFSTATE_EXT=$(shell yq '.infrastructure.terraform.env_var.set.TFSTATE_EXT.default' $(PROJECT_CONF))
TFSTATE_ENV_SUFFIX=$(shell yq '.infra.terraform.env_var.set.TFSTATE_ENV_SUFFIX.default' $(PROJECT_CONF))
TFSTATE_EXT=$(shell yq '.infra.terraform.env_var.set.TFSTATE_EXT.default' $(PROJECT_CONF))
TFSTATE_ENV=$(TFSTATE_ENV_SUFFIX).$(TFSTATE_EXT)

### arg test
Expand All @@ -18,10 +18,10 @@ resume:
--env-id $(ENV_ID); \
bash scripts/terraform-init-dev.sh \
--key $(TFSTATE_ENV) \
--dir infrastructure/terraform/aws/environments/dev
--dir infra/terraform/aws/environments/dev

init:
cd $(RELATIVE_PROJECT_ROOT_PATH); \
bash scripts/terraform-init-dev.sh \
--key $(TFSTATE_ENV) \
--dir infrastructure/terraform/aws/environments/dev
--dir infra/terraform/aws/environments/dev
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
locals {
ENV = "dev"
PROJECT_CONF = yamldecode(file("../../../../../project.yaml"))
INFRA_ENV_VAR = local.PROJECT_CONF.infrastructure.terraform.aws.modules.environment.env_var.set
INFRA_ENV_VAR = local.PROJECT_CONF.infra.terraform.aws.modules.environment.env_var.set
ENV_ID = module.env_id.ENV_ID
STORAGE_ENV_VAR = local.PROJECT_CONF.infrastructure.terraform.aws.modules.project-storage.env_var.set
STORAGE_ENV_VAR = local.PROJECT_CONF.infra.terraform.aws.modules.project-storage.env_var.set
}

module "env_id" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
locals {
ENV = "prod"
PROJECT_CONF = yamldecode(file("../../../../../project.yaml"))
INFRA_ENV_VAR = local.PROJECT_CONF.infrastructure.terraform.aws.modules.environment.env_var.set
INFRA_ENV_VAR = local.PROJECT_CONF.infra.terraform.aws.modules.environment.env_var.set
ENV_ID = local.PROJECT_CONF.env_var.set.PROD_ENV_ID.default
STORAGE_ENV_VAR = local.PROJECT_CONF.infrastructure.terraform.aws.modules.project-storage.env_var.set
STORAGE_ENV_VAR = local.PROJECT_CONF.infra.terraform.aws.modules.project-storage.env_var.set
}

provider "aws" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ locals {
ENV = "prod"
APP_ENV = "${local.APP}-${local.ENV}"
PROJECT_CONF = yamldecode(file("../../../../../project.yaml"))
STORAGE_ENV_VAR = local.PROJECT_CONF.infrastructure.terraform.aws.modules.project-storage.env_var.set
STORAGE_ENV_VAR = local.PROJECT_CONF.infra.terraform.aws.modules.project-storage.env_var.set
ORIGIN_PREFIX = local.STORAGE_ENV_VAR.CLIENT_ORIGIN_BUCKET_PREFIX.default
ARTIFACTS_PREFIX = local.STORAGE_ENV_VAR.ARTIFACTS_BUCKET_PREFIX.default
TFSTATE_PREFIX = local.STORAGE_ENV_VAR.TFSTATE_BUCKET_PREFIX.default
INFRA_ENV_VAR = local.PROJECT_CONF.infrastructure.terraform.aws.modules.environment.env_var.set
INFRA_ENV_VAR = local.PROJECT_CONF.infra.terraform.aws.modules.environment.env_var.set
RDS_PREFIX = local.INFRA_ENV_VAR.RDS_PREFIX.default
REGION = local.INFRA_ENV_VAR.REGION.default
ENV_ID = local.PROJECT_CONF.env_var.set.PROD_ENV_ID.default
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
locals {
PROJECT_CONF = yamldecode(file("../../../../../project.yaml"))
REGION = local.PROJECT_CONF.infrastructure.terraform.aws.modules.environment.env_var.set.REGION.default
REGION = local.PROJECT_CONF.infra.terraform.aws.modules.environment.env_var.set.REGION.default
}

provider "aws" {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// bucket provisioned in infrastructure/terraform/aws/environments/init-env
// bucket provisioned in infra/terraform/aws/environments/init-env

resource "random_password" "referer" {
length = 24
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ resource "aws_security_group" "default" {

data "aws_db_subnet_group" "default" {
# todo: replace hardcoded "db-subnet-group" prefix with variable here and
# in infrastructure/terraform/aws/modules/environment/v001/rds.tf
# in infra/terraform/aws/modules/environment/v001/rds.tf
name = "db-subnet-group-${local.ID_ENV}"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ locals {
TITLED_ID_ENV = replace(title(local.ID_ENV), "-", "")
SPACED_ID_ENV = replace(local.ID_ENV, "-", " ")
PROJECT_CONF = yamldecode(file("../../../../../project.yaml"))
MICROK8S_CONF = local.PROJECT_CONF.infrastructure.terraform.aws.modules.microk8s.env_var.set
MICROK8S_CONF = local.PROJECT_CONF.infra.terraform.aws.modules.microk8s.env_var.set
MICROK8S_SSH_KEY_NAME_PREFIX = local.MICROK8S_CONF.MICROK8S_SSH_KEY_NAME_PREFIX.default
MICROK8S_SSH_PORT = local.MICROK8S_CONF.MICROK8S_SSH_PORT.default
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ locals {
ID_ENV = "${var.env_id}-${var.env}"
PROJECT_CONF = "project.yaml"
CONF_FILE = yamldecode(file("../../../../../${local.PROJECT_CONF}"))
STORAGE_ENV_VAR = local.CONF_FILE.infrastructure.terraform.aws.modules.project-storage.env_var.set
STORAGE_ENV_VAR = local.CONF_FILE.infra.terraform.aws.modules.project-storage.env_var.set
DDB_TABLE_NAME_PREFIX = local.STORAGE_ENV_VAR.DDB_TABLE_NAME_PREFIX.default
DDB_TABLE_HASH_KEY = local.STORAGE_ENV_VAR.DDB_TABLE_HASH_KEY.default
ID_ENV_PREFIX = "${var.env_id}/${var.env}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#### provided runtime lambda terraform module

general use:
1. requires adding an `aws_ecr_repository` resource to `infrastructure/terraform/aws/modules/project-storage/v001/ecr.tf`
1. requires adding an `aws_ecr_repository` resource to `infra/terraform/aws/modules/project-storage/v001/ecr.tf`
1. build, tag and push image, e.g. `make/ecr-lambda.mk`
1. `terraform apply`

Expand All @@ -14,7 +14,7 @@ lambda web adapter use:
1. assign `var.aws_lwa_port` a unique project application port* to configure the [lambda web adapter](https://github.com/awslabs/aws-lambda-web-adapter)

examples:
1. `infrastructure/terraform/aws/modules/environment/v001/lambda-services.tf`
1. `infrastructure/terraform/aws/modules/environment/v001/go-migrate.tf`
1. `infra/terraform/aws/modules/environment/v001/lambda-services.tf`
1. `infra/terraform/aws/modules/environment/v001/go-migrate.tf`

\* `project.yaml` env vars with _PORT suffixes are assigned unique port numbers
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ locals {
SERVICE_NAME_LOWER = replace(var.service_name, "-", "_")
LOG_GROUP_NAME = "/aws/lambda/${aws_lambda_function.default.function_name}"
PROJECT_CONF = yamldecode(file("../../../../../project.yaml"))
ENVIRONMENT_CONF = local.PROJECT_CONF.infrastructure.terraform.aws.modules.environment.env_var.set
ENVIRONMENT_CONF = local.PROJECT_CONF.infra.terraform.aws.modules.environment.env_var.set
READINESS_CHECK_PATH = local.ENVIRONMENT_CONF.READINESS_CHECK_PATH.default
}

Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions k8s/makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
RELATIVE_PROJECT_ROOT_PATH=..
include $(RELATIVE_PROJECT_ROOT_PATH)/make/shared.mk
SSH_KEY_SSM_SUFFIX=$(shell yq '.infrastructure.terraform.aws.modules.microk8s.env_var.set.MICROK8S_SSH_PRIV_KEY.ssm' $(PROJECT_CONF))
MICROK8S_SSH_KEY_NAME_PREFIX=$(shell yq '.infrastructure.terraform.aws.modules.microk8s.env_var.set.MICROK8S_SSH_KEY_NAME_PREFIX.default' $(PROJECT_CONF))
MICROK8S_SSH_USER=$(shell yq '.infrastructure.terraform.aws.modules.microk8s.env_var.set.MICROK8S_SSH_USER.default' $(PROJECT_CONF))
MICROK8S_MANIFESTS_DIR=$(shell yq '.infrastructure.terraform.aws.modules.microk8s.env_var.set.MICROK8S_MANIFESTS_DIR.default' $(PROJECT_CONF))
SSH_KEY_SSM_SUFFIX=$(shell yq '.infra.terraform.aws.modules.microk8s.env_var.set.MICROK8S_SSH_PRIV_KEY.ssm' $(PROJECT_CONF))
MICROK8S_SSH_KEY_NAME_PREFIX=$(shell yq '.infra.terraform.aws.modules.microk8s.env_var.set.MICROK8S_SSH_KEY_NAME_PREFIX.default' $(PROJECT_CONF))
MICROK8S_SSH_USER=$(shell yq '.infra.terraform.aws.modules.microk8s.env_var.set.MICROK8S_SSH_USER.default' $(PROJECT_CONF))
MICROK8S_MANIFESTS_DIR=$(shell yq '.infra.terraform.aws.modules.microk8s.env_var.set.MICROK8S_MANIFESTS_DIR.default' $(PROJECT_CONF))

# avoid assigning ENV_ID on local commands or when ENV is not assigned
ifneq ($(origin ENV), undefined)
Expand Down
2 changes: 1 addition & 1 deletion make/shared.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PROJECT_CONF_FILE_NAME=project.yaml
PROJECT_CONF=$(RELATIVE_PROJECT_ROOT_PATH)/$(PROJECT_CONF_FILE_NAME)
ROOT_PATH=$(shell cd $(RELATIVE_PROJECT_ROOT_PATH); pwd)
SUB_PATH=$(shell printf '%s' $(CURDIR) | awk -F'$(ROOT_PATH)' '{print substr($$NF, 2)}')
REGION=$(shell yq '.infrastructure.terraform.aws.modules.environment.env_var.set.REGION.default' $(PROJECT_CONF))
REGION=$(shell yq '.infra.terraform.aws.modules.environment.env_var.set.REGION.default' $(PROJECT_CONF))
LAMBDA_NAME=$(APP_NAME)-$(ENV)
ENV_FILE_NAME=$(shell yq '.env_var.set.ENV_FILE_NAME.default' $(PROJECT_CONF))
ENV_FILE=$(CURDIR)/$(ENV_FILE_NAME)
Expand Down
12 changes: 6 additions & 6 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ endif
PROJECT_CONF=project.yaml
SECRETS=$(shell yq '.env_var.get[]' $(PROJECT_CONF))
ENV_VARS=$(SECRETS)
REGION=$(shell yq '.infrastructure.terraform.aws.modules.environment.env_var.set.REGION.default' $(PROJECT_CONF))
REGION=$(shell yq '.infra.terraform.aws.modules.environment.env_var.set.REGION.default' $(PROJECT_CONF))
ENV_FILE_NAME=$(shell yq '.env_var.set.ENV_FILE_NAME.default' $(PROJECT_CONF))
ENV_FILE=$(CURDIR)/$(ENV_FILE_NAME)
TFSTATE_ENV_SUFFIX=$(shell yq '.infrastructure.terraform.env_var.set.TFSTATE_ENV_SUFFIX.default' $(PROJECT_CONF))
TFSTATE_EXT=$(shell yq '.infrastructure.terraform.env_var.set.TFSTATE_EXT.default' $(PROJECT_CONF))
TFSTATE_ENV_SUFFIX=$(shell yq '.infra.terraform.env_var.set.TFSTATE_ENV_SUFFIX.default' $(PROJECT_CONF))
TFSTATE_EXT=$(shell yq '.infra.terraform.env_var.set.TFSTATE_EXT.default' $(PROJECT_CONF))
TFSTATE_ENV_FILE=$(TFSTATE_ENV_SUFFIX).$(TFSTATE_EXT)
COMPOSE_DIR=./docker
NOHUP_LOG=$(shell yq '.env_var.set.NOHUP_LOG.default' $(PROJECT_CONF))
Expand Down Expand Up @@ -109,18 +109,18 @@ delete-dev:
bash scripts/delete-dev-env.sh

delete-dev-state:
(cd infrastructure/terraform/aws/environments/dev; rm -rf .terraform* .tfplan*)
(cd infra/terraform/aws/environments/dev; rm -rf .terraform* .tfplan*)

init-dev:
bash scripts/terraform-init-dev.sh \
--key $(TFSTATE_ENV_FILE) \
--dir infrastructure/terraform/aws/environments/dev
--dir infra/terraform/aws/environments/dev

set-env-id:
$(MAKE) resume-dev

resume-dev:
$(MAKE) -C infrastructure/terraform/aws/environments/dev resume
$(MAKE) -C infra/terraform/aws/environments/dev resume

new-iam:
bash scripts/manage-gitpod-iam.sh --new
Expand Down
4 changes: 2 additions & 2 deletions migrations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ test db = `./schema` + `./seed` + `./testseed`
1. navigate to `/aws/lambda/go-migrate-faas-dev` log group in cloudwatch to view lambda logs

### create a TEST database in postgres rds from lambda
1. provision a terraform stack, e.g. `infrastructure/terraform/aws/environments/dev`
1. provision a terraform stack, e.g. `infra/terraform/aws/environments/dev`
1. set the `MIGRATION_LAMBDA_NAME` variable in `mirations/makefile`
1. `make lambda-up-all DB=test ENV=dev BRANCH=199/db-item-transaction` deploys all migration directories
1. `make lambda-down-all DB=test ENV=dev BRANCH=199/db-item-transaction` removes all migrations
Expand All @@ -76,7 +76,7 @@ test db = `./schema` + `./seed` + `./testseed`
\* ***includes** `./testseed` migrations*

### create a PROD database in postgres rds from lambda
1. provision a terraform stack, e.g. `infrastructure/terraform/aws/environments/prod`
1. provision a terraform stack, e.g. `infra/terraform/aws/environments/prod`
1. set the `MIGRATION_LAMBDA_NAME` variable in `mirations/makefile`
1. `make lambda-up-all DB=prod ENV=prod BRANCH=199/db-item-transaction` up migrates all versions from checked in `./schema` and `./seed` migration directories
1. `make lambda-down-all DB=prod ENV=prod BRANCH=199/db-item-transaction` deploys all down migrations from the checked in `./schema` and `./seed` directories
Expand Down
2 changes: 1 addition & 1 deletion migrations/go-migrate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ deploys migrations in `/mxfactorial/migrations/$DESIRED_MIGRATION_DIRECTORY` to
#### deploy migrations
1. see `/mxfactorial/migrations/README.md`

terraform: https://github.com/systemaccounting/mxfactorial/blob/develop/infrastructure/terraform/aws/modules/environment/v001/go-migrate.tf
terraform: https://github.com/systemaccounting/mxfactorial/blob/develop/infra/terraform/aws/modules/environment/v001/go-migrate.tf
4 changes: 2 additions & 2 deletions migrations/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ MIGRATIONS_DIR=$(CURDIR)/$(DIR)

# go-migrate lambda vars
MIGRATION_LAMBDA_NAME=go-migrate-$(ENV_ID)-$(ENV)
REGION=$(shell yq '.infrastructure.terraform.aws.modules.environment.env_var.set.REGION.default' $(PROJECT_CONF))
SSM_VERSION=$(shell yq '.infrastructure.terraform.aws.modules.environment.env_var.set.SSM_VERSION.default' $(PROJECT_CONF))
REGION=$(shell yq '.infra.terraform.aws.modules.environment.env_var.set.REGION.default' $(PROJECT_CONF))
SSM_VERSION=$(shell yq '.infra.terraform.aws.modules.environment.env_var.set.SSM_VERSION.default' $(PROJECT_CONF))
GO_MIGRATE_PASSPHRASE=$(shell aws ssm get-parameter \
--name /$(ENV_ID)/$(SSM_VERSION)/$(ENV)/tool/lambda/go_migrate/passphrase \
--query 'Parameter.Value' \
Expand Down
2 changes: 1 addition & 1 deletion project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ docker:
LOCAL_TAG_VERSION:
ssm: null
default: latest
infrastructure:
infra:
terraform:
env_var:
set:
Expand Down
12 changes: 6 additions & 6 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ add and edit by assigning variables from root `project.yaml` to avoid reconcilin

`project.yaml`
```yaml
infrastructure:
infra:
terraform:
aws:
modules:
Expand All @@ -19,14 +19,14 @@ infrastructure:
default: mxfactorial-artifacts
```
`infrastructure/terraform/aws/environments/prod/main.tf`
`infra/terraform/aws/environments/prod/main.tf`
```
ARTIFACTS_BUCKET_PREFIX = jsondecode(file("../../../../../project.yaml")).infrastructure.terraform.aws.modules.project-storage.env_var.set.ARTIFACTS_BUCKET_PREFIX.default
ARTIFACTS_BUCKET_PREFIX = jsondecode(file("../../../../../project.yaml")).infra.terraform.aws.modules.project-storage.env_var.set.ARTIFACTS_BUCKET_PREFIX.default
```
`scripts/put-object.sh`
```sh
ARTIFACTS_BUCKET_PREFIX=$(yq ".infrastructure.terraform.aws.modules["project-storage"].env_var.set.ARTIFACTS_BUCKET_PREFIX.default" project.yaml)
ARTIFACTS_BUCKET_PREFIX=$(yq ".infra.terraform.aws.modules["project-storage"].env_var.set.ARTIFACTS_BUCKET_PREFIX.default" project.yaml)
```

\*scripts assume **project root** as initial current working directory
Expand Down Expand Up @@ -246,7 +246,7 @@ update lambda with latest ecr repository image

##### `import-tf-init-env.sh`

imports resources into the `infrastructure/terraform/aws/environments/init-$ENV`terraform configuration files
imports resources into the `infra/terraform/aws/environments/init-$ENV`terraform configuration files

##### `rust-coverage.sh`

Expand Down Expand Up @@ -322,7 +322,7 @@ adds a [$RANDOM](https://tldp.org/LDP/abs/html/randomvar.html) `ENV_ID` variable
deletes the `ENV_ID` variable from `.env` in project root

##### `delete-api-log-perms.sh`
deletes the api gateway logging permissions added in `infrastructure/terraform/aws/environments/region/main.tf`
deletes the api gateway logging permissions added in `infra/terraform/aws/environments/region/main.tf`

##### `enable-pg-notice.sh`
sets [log_min_messages](https://www.postgresql.org/docs/current/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHEN) to notice in docker postgres
Expand Down
2 changes: 1 addition & 1 deletion scripts/auth-ecr.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

PROJECT_CONF=project.yaml
REGION=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF)
REGION=$(yq '.infra.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF)
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text)

aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com
4 changes: 2 additions & 2 deletions scripts/build-all-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ ENV=dev
PROJECT_CONF=project.yaml
ENV_ID=$(source ./scripts/print-env-id.sh)
ID_ENV="$ENV_ID-$ENV"
REGION=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF)
ARTIFACTS_BUCKET_PREFIX=$(yq '.infrastructure.terraform.aws.modules["project-storage"].env_var.set.ARTIFACTS_BUCKET_PREFIX.default' $PROJECT_CONF)
REGION=$(yq '.infra.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF)
ARTIFACTS_BUCKET_PREFIX=$(yq '.infra.terraform.aws.modules["project-storage"].env_var.set.ARTIFACTS_BUCKET_PREFIX.default' $PROJECT_CONF)
ARTIFACTS_BUCKET="$ARTIFACTS_BUCKET_PREFIX-$ID_ENV"
IMAGE_BUILDER_WORKFLOW=$(yq '.[".github"].workflows.env_var.set.IMAGE_BUILDER_WORKFLOW.default' $PROJECT_CONF)
WORKFLOW_ID=$IMAGE_BUILDER_WORKFLOW
Expand Down
Loading

0 comments on commit 1a956c3

Please sign in to comment.