diff --git a/.gitignore b/.gitignore index 7463647e9..ce509e78d 100644 --- a/.gitignore +++ b/.gitignore @@ -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 @@ -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 diff --git a/client/makefile b/client/makefile index 208a7a6b0..cfc88e7c7 100644 --- a/client/makefile +++ b/client/makefile @@ -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)) diff --git a/infrastructure/terraform/aws/environments/dev/main.tf b/infra/terraform/aws/environments/dev/main.tf similarity index 92% rename from infrastructure/terraform/aws/environments/dev/main.tf rename to infra/terraform/aws/environments/dev/main.tf index 76220a851..7438a1d8c 100644 --- a/infrastructure/terraform/aws/environments/dev/main.tf +++ b/infra/terraform/aws/environments/dev/main.tf @@ -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 @@ -74,7 +74,7 @@ module "dev" { enable_api_auto_deploy = true ############### k8s ############### - + microk8s_instance_type = "t2.medium" enable_microk8s = false diff --git a/infrastructure/terraform/aws/environments/dev/makefile b/infra/terraform/aws/environments/dev/makefile similarity index 66% rename from infrastructure/terraform/aws/environments/dev/makefile rename to infra/terraform/aws/environments/dev/makefile index f858f7385..27bf97eb1 100644 --- a/infrastructure/terraform/aws/environments/dev/makefile +++ b/infra/terraform/aws/environments/dev/makefile @@ -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 @@ -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 \ No newline at end of file + --dir infra/terraform/aws/environments/dev \ No newline at end of file diff --git a/infrastructure/terraform/aws/environments/init-dev/main.tf b/infra/terraform/aws/environments/init-dev/main.tf similarity index 84% rename from infrastructure/terraform/aws/environments/init-dev/main.tf rename to infra/terraform/aws/environments/init-dev/main.tf index 450384fb9..efdb9ae43 100644 --- a/infrastructure/terraform/aws/environments/init-dev/main.tf +++ b/infra/terraform/aws/environments/init-dev/main.tf @@ -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" { diff --git a/infrastructure/terraform/aws/environments/init-prod/.terraform.lock.hcl b/infra/terraform/aws/environments/init-prod/.terraform.lock.hcl similarity index 100% rename from infrastructure/terraform/aws/environments/init-prod/.terraform.lock.hcl rename to infra/terraform/aws/environments/init-prod/.terraform.lock.hcl diff --git a/infrastructure/terraform/aws/environments/init-prod/main.tf b/infra/terraform/aws/environments/init-prod/main.tf similarity index 83% rename from infrastructure/terraform/aws/environments/init-prod/main.tf rename to infra/terraform/aws/environments/init-prod/main.tf index dae1718d6..a5490936e 100644 --- a/infrastructure/terraform/aws/environments/init-prod/main.tf +++ b/infra/terraform/aws/environments/init-prod/main.tf @@ -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" { diff --git a/infrastructure/terraform/aws/environments/prod/.terraform.lock.hcl b/infra/terraform/aws/environments/prod/.terraform.lock.hcl similarity index 100% rename from infrastructure/terraform/aws/environments/prod/.terraform.lock.hcl rename to infra/terraform/aws/environments/prod/.terraform.lock.hcl diff --git a/infrastructure/terraform/aws/environments/prod/main.tf b/infra/terraform/aws/environments/prod/main.tf similarity index 93% rename from infrastructure/terraform/aws/environments/prod/main.tf rename to infra/terraform/aws/environments/prod/main.tf index 35ec87914..f3bc1dbff 100644 --- a/infrastructure/terraform/aws/environments/prod/main.tf +++ b/infra/terraform/aws/environments/prod/main.tf @@ -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 diff --git a/infrastructure/terraform/aws/environments/prod/www-certs.tf b/infra/terraform/aws/environments/prod/www-certs.tf similarity index 100% rename from infrastructure/terraform/aws/environments/prod/www-certs.tf rename to infra/terraform/aws/environments/prod/www-certs.tf diff --git a/infrastructure/terraform/aws/environments/prod/www.tf b/infra/terraform/aws/environments/prod/www.tf similarity index 100% rename from infrastructure/terraform/aws/environments/prod/www.tf rename to infra/terraform/aws/environments/prod/www.tf diff --git a/infrastructure/terraform/aws/environments/region/main.tf b/infra/terraform/aws/environments/region/main.tf similarity index 62% rename from infrastructure/terraform/aws/environments/region/main.tf rename to infra/terraform/aws/environments/region/main.tf index 94aa9fd3d..2c188c761 100644 --- a/infrastructure/terraform/aws/environments/region/main.tf +++ b/infra/terraform/aws/environments/region/main.tf @@ -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" { diff --git a/infrastructure/terraform/aws/modules/acm-certs/v001/certs.tf b/infra/terraform/aws/modules/acm-certs/v001/certs.tf similarity index 100% rename from infrastructure/terraform/aws/modules/acm-certs/v001/certs.tf rename to infra/terraform/aws/modules/acm-certs/v001/certs.tf diff --git a/infrastructure/terraform/aws/modules/acm-certs/v001/outputs.tf b/infra/terraform/aws/modules/acm-certs/v001/outputs.tf similarity index 100% rename from infrastructure/terraform/aws/modules/acm-certs/v001/outputs.tf rename to infra/terraform/aws/modules/acm-certs/v001/outputs.tf diff --git a/infrastructure/terraform/aws/modules/acm-certs/v001/variables.tf b/infra/terraform/aws/modules/acm-certs/v001/variables.tf similarity index 100% rename from infrastructure/terraform/aws/modules/acm-certs/v001/variables.tf rename to infra/terraform/aws/modules/acm-certs/v001/variables.tf diff --git a/infrastructure/terraform/aws/modules/apigwv2-dns/v001/dns.tf b/infra/terraform/aws/modules/apigwv2-dns/v001/dns.tf similarity index 100% rename from infrastructure/terraform/aws/modules/apigwv2-dns/v001/dns.tf rename to infra/terraform/aws/modules/apigwv2-dns/v001/dns.tf diff --git a/infrastructure/terraform/aws/modules/apigwv2-dns/v001/variables.tf b/infra/terraform/aws/modules/apigwv2-dns/v001/variables.tf similarity index 100% rename from infrastructure/terraform/aws/modules/apigwv2-dns/v001/variables.tf rename to infra/terraform/aws/modules/apigwv2-dns/v001/variables.tf diff --git a/infrastructure/terraform/aws/modules/apigwv2-lambda/v001/apigwv2.tf b/infra/terraform/aws/modules/apigwv2-lambda/v001/apigwv2.tf similarity index 100% rename from infrastructure/terraform/aws/modules/apigwv2-lambda/v001/apigwv2.tf rename to infra/terraform/aws/modules/apigwv2-lambda/v001/apigwv2.tf diff --git a/infrastructure/terraform/aws/modules/apigwv2-lambda/v001/outputs.tf b/infra/terraform/aws/modules/apigwv2-lambda/v001/outputs.tf similarity index 100% rename from infrastructure/terraform/aws/modules/apigwv2-lambda/v001/outputs.tf rename to infra/terraform/aws/modules/apigwv2-lambda/v001/outputs.tf diff --git a/infrastructure/terraform/aws/modules/apigwv2-lambda/v001/variables.tf b/infra/terraform/aws/modules/apigwv2-lambda/v001/variables.tf similarity index 100% rename from infrastructure/terraform/aws/modules/apigwv2-lambda/v001/variables.tf rename to infra/terraform/aws/modules/apigwv2-lambda/v001/variables.tf diff --git a/infrastructure/terraform/aws/modules/apigwv2-route/v001/apigwv2.tf b/infra/terraform/aws/modules/apigwv2-route/v001/apigwv2.tf similarity index 100% rename from infrastructure/terraform/aws/modules/apigwv2-route/v001/apigwv2.tf rename to infra/terraform/aws/modules/apigwv2-route/v001/apigwv2.tf diff --git a/infrastructure/terraform/aws/modules/apigwv2-route/v001/outputs.tf b/infra/terraform/aws/modules/apigwv2-route/v001/outputs.tf similarity index 100% rename from infrastructure/terraform/aws/modules/apigwv2-route/v001/outputs.tf rename to infra/terraform/aws/modules/apigwv2-route/v001/outputs.tf diff --git a/infrastructure/terraform/aws/modules/apigwv2-route/v001/variables.tf b/infra/terraform/aws/modules/apigwv2-route/v001/variables.tf similarity index 100% rename from infrastructure/terraform/aws/modules/apigwv2-route/v001/variables.tf rename to infra/terraform/aws/modules/apigwv2-route/v001/variables.tf diff --git a/infrastructure/terraform/aws/modules/ecr/v001/ecr.tf b/infra/terraform/aws/modules/ecr/v001/ecr.tf similarity index 100% rename from infrastructure/terraform/aws/modules/ecr/v001/ecr.tf rename to infra/terraform/aws/modules/ecr/v001/ecr.tf diff --git a/infrastructure/terraform/aws/modules/ecr/v001/variables.tf b/infra/terraform/aws/modules/ecr/v001/variables.tf similarity index 100% rename from infrastructure/terraform/aws/modules/ecr/v001/variables.tf rename to infra/terraform/aws/modules/ecr/v001/variables.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/cloudfront.tf b/infra/terraform/aws/modules/environment/v001/cloudfront.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/cloudfront.tf rename to infra/terraform/aws/modules/environment/v001/cloudfront.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/cognito.tf b/infra/terraform/aws/modules/environment/v001/cognito.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/cognito.tf rename to infra/terraform/aws/modules/environment/v001/cognito.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/go-migrate.tf b/infra/terraform/aws/modules/environment/v001/go-migrate.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/go-migrate.tf rename to infra/terraform/aws/modules/environment/v001/go-migrate.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/graphql-api.tf b/infra/terraform/aws/modules/environment/v001/graphql-api.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/graphql-api.tf rename to infra/terraform/aws/modules/environment/v001/graphql-api.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/k8s.tf b/infra/terraform/aws/modules/environment/v001/k8s.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/k8s.tf rename to infra/terraform/aws/modules/environment/v001/k8s.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/lambda-services.tf b/infra/terraform/aws/modules/environment/v001/lambda-services.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/lambda-services.tf rename to infra/terraform/aws/modules/environment/v001/lambda-services.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/locals.tf b/infra/terraform/aws/modules/environment/v001/locals.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/locals.tf rename to infra/terraform/aws/modules/environment/v001/locals.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/rds.tf b/infra/terraform/aws/modules/environment/v001/rds.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/rds.tf rename to infra/terraform/aws/modules/environment/v001/rds.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/region.tf b/infra/terraform/aws/modules/environment/v001/region.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/region.tf rename to infra/terraform/aws/modules/environment/v001/region.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/route53.tf b/infra/terraform/aws/modules/environment/v001/route53.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/route53.tf rename to infra/terraform/aws/modules/environment/v001/route53.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/s3.tf b/infra/terraform/aws/modules/environment/v001/s3.tf similarity index 92% rename from infrastructure/terraform/aws/modules/environment/v001/s3.tf rename to infra/terraform/aws/modules/environment/v001/s3.tf index 891ed21af..ad1996b29 100644 --- a/infrastructure/terraform/aws/modules/environment/v001/s3.tf +++ b/infra/terraform/aws/modules/environment/v001/s3.tf @@ -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 diff --git a/infrastructure/terraform/aws/modules/environment/v001/ssm.tf b/infra/terraform/aws/modules/environment/v001/ssm.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/ssm.tf rename to infra/terraform/aws/modules/environment/v001/ssm.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/variables.tf b/infra/terraform/aws/modules/environment/v001/variables.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/variables.tf rename to infra/terraform/aws/modules/environment/v001/variables.tf diff --git a/infrastructure/terraform/aws/modules/environment/v001/vpc.tf b/infra/terraform/aws/modules/environment/v001/vpc.tf similarity index 100% rename from infrastructure/terraform/aws/modules/environment/v001/vpc.tf rename to infra/terraform/aws/modules/environment/v001/vpc.tf diff --git a/infrastructure/terraform/aws/modules/microk8s/v001/ec2.tf b/infra/terraform/aws/modules/microk8s/v001/ec2.tf similarity index 96% rename from infrastructure/terraform/aws/modules/microk8s/v001/ec2.tf rename to infra/terraform/aws/modules/microk8s/v001/ec2.tf index 46c4ae24b..c2d12bc24 100644 --- a/infrastructure/terraform/aws/modules/microk8s/v001/ec2.tf +++ b/infra/terraform/aws/modules/microk8s/v001/ec2.tf @@ -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}" } diff --git a/infrastructure/terraform/aws/modules/microk8s/v001/locals.tf b/infra/terraform/aws/modules/microk8s/v001/locals.tf similarity index 81% rename from infrastructure/terraform/aws/modules/microk8s/v001/locals.tf rename to infra/terraform/aws/modules/microk8s/v001/locals.tf index c98bb2a5a..05b24760c 100644 --- a/infrastructure/terraform/aws/modules/microk8s/v001/locals.tf +++ b/infra/terraform/aws/modules/microk8s/v001/locals.tf @@ -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 } diff --git a/infrastructure/terraform/aws/modules/microk8s/v001/ssm.tf b/infra/terraform/aws/modules/microk8s/v001/ssm.tf similarity index 100% rename from infrastructure/terraform/aws/modules/microk8s/v001/ssm.tf rename to infra/terraform/aws/modules/microk8s/v001/ssm.tf diff --git a/infrastructure/terraform/aws/modules/microk8s/v001/user-data.sh b/infra/terraform/aws/modules/microk8s/v001/user-data.sh similarity index 100% rename from infrastructure/terraform/aws/modules/microk8s/v001/user-data.sh rename to infra/terraform/aws/modules/microk8s/v001/user-data.sh diff --git a/infrastructure/terraform/aws/modules/microk8s/v001/variables.tf b/infra/terraform/aws/modules/microk8s/v001/variables.tf similarity index 100% rename from infrastructure/terraform/aws/modules/microk8s/v001/variables.tf rename to infra/terraform/aws/modules/microk8s/v001/variables.tf diff --git a/infrastructure/terraform/aws/modules/project-storage/v001/dynamodb.tf b/infra/terraform/aws/modules/project-storage/v001/dynamodb.tf similarity index 100% rename from infrastructure/terraform/aws/modules/project-storage/v001/dynamodb.tf rename to infra/terraform/aws/modules/project-storage/v001/dynamodb.tf diff --git a/infrastructure/terraform/aws/modules/project-storage/v001/ecr.tf b/infra/terraform/aws/modules/project-storage/v001/ecr.tf similarity index 100% rename from infrastructure/terraform/aws/modules/project-storage/v001/ecr.tf rename to infra/terraform/aws/modules/project-storage/v001/ecr.tf diff --git a/infrastructure/terraform/aws/modules/project-storage/v001/locals.tf b/infra/terraform/aws/modules/project-storage/v001/locals.tf similarity index 97% rename from infrastructure/terraform/aws/modules/project-storage/v001/locals.tf rename to infra/terraform/aws/modules/project-storage/v001/locals.tf index effb6349c..b37b935a2 100644 --- a/infrastructure/terraform/aws/modules/project-storage/v001/locals.tf +++ b/infra/terraform/aws/modules/project-storage/v001/locals.tf @@ -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}" diff --git a/infrastructure/terraform/aws/modules/project-storage/v001/s3.tf b/infra/terraform/aws/modules/project-storage/v001/s3.tf similarity index 100% rename from infrastructure/terraform/aws/modules/project-storage/v001/s3.tf rename to infra/terraform/aws/modules/project-storage/v001/s3.tf diff --git a/infrastructure/terraform/aws/modules/project-storage/v001/variables.tf b/infra/terraform/aws/modules/project-storage/v001/variables.tf similarity index 100% rename from infrastructure/terraform/aws/modules/project-storage/v001/variables.tf rename to infra/terraform/aws/modules/project-storage/v001/variables.tf diff --git a/infrastructure/terraform/aws/modules/provided-lambda/v001/README.md b/infra/terraform/aws/modules/provided-lambda/v001/README.md similarity index 72% rename from infrastructure/terraform/aws/modules/provided-lambda/v001/README.md rename to infra/terraform/aws/modules/provided-lambda/v001/README.md index 7678e4b3e..481c366f1 100644 --- a/infrastructure/terraform/aws/modules/provided-lambda/v001/README.md +++ b/infra/terraform/aws/modules/provided-lambda/v001/README.md @@ -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` @@ -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 \ No newline at end of file diff --git a/infrastructure/terraform/aws/modules/provided-lambda/v001/lambda.tf b/infra/terraform/aws/modules/provided-lambda/v001/lambda.tf similarity index 98% rename from infrastructure/terraform/aws/modules/provided-lambda/v001/lambda.tf rename to infra/terraform/aws/modules/provided-lambda/v001/lambda.tf index 5a373f242..6a56ab586 100644 --- a/infrastructure/terraform/aws/modules/provided-lambda/v001/lambda.tf +++ b/infra/terraform/aws/modules/provided-lambda/v001/lambda.tf @@ -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 } diff --git a/infrastructure/terraform/aws/modules/provided-lambda/v001/outputs.tf b/infra/terraform/aws/modules/provided-lambda/v001/outputs.tf similarity index 100% rename from infrastructure/terraform/aws/modules/provided-lambda/v001/outputs.tf rename to infra/terraform/aws/modules/provided-lambda/v001/outputs.tf diff --git a/infrastructure/terraform/aws/modules/provided-lambda/v001/variables.tf b/infra/terraform/aws/modules/provided-lambda/v001/variables.tf similarity index 100% rename from infrastructure/terraform/aws/modules/provided-lambda/v001/variables.tf rename to infra/terraform/aws/modules/provided-lambda/v001/variables.tf diff --git a/infrastructure/terraform/aws/modules/region/v001/apigw-logging.tf b/infra/terraform/aws/modules/region/v001/apigw-logging.tf similarity index 100% rename from infrastructure/terraform/aws/modules/region/v001/apigw-logging.tf rename to infra/terraform/aws/modules/region/v001/apigw-logging.tf diff --git a/infrastructure/terraform/modules/README.md b/infra/terraform/modules/README.md similarity index 100% rename from infrastructure/terraform/modules/README.md rename to infra/terraform/modules/README.md diff --git a/infrastructure/terraform/modules/env-id/v001/README.md b/infra/terraform/modules/env-id/v001/README.md similarity index 100% rename from infrastructure/terraform/modules/env-id/v001/README.md rename to infra/terraform/modules/env-id/v001/README.md diff --git a/infrastructure/terraform/modules/env-id/v001/env-id.tf b/infra/terraform/modules/env-id/v001/env-id.tf similarity index 100% rename from infrastructure/terraform/modules/env-id/v001/env-id.tf rename to infra/terraform/modules/env-id/v001/env-id.tf diff --git a/k8s/makefile b/k8s/makefile index 382daf85b..97c9e8db3 100644 --- a/k8s/makefile +++ b/k8s/makefile @@ -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) diff --git a/make/shared.mk b/make/shared.mk index b47d91231..339587cf8 100644 --- a/make/shared.mk +++ b/make/shared.mk @@ -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) diff --git a/makefile b/makefile index f9525311b..537cf5987 100644 --- a/makefile +++ b/makefile @@ -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)) @@ -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 diff --git a/migrations/README.md b/migrations/README.md index 25c578671..062c81500 100644 --- a/migrations/README.md +++ b/migrations/README.md @@ -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 @@ -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 diff --git a/migrations/go-migrate/README.md b/migrations/go-migrate/README.md index 3f908b676..718afed14 100644 --- a/migrations/go-migrate/README.md +++ b/migrations/go-migrate/README.md @@ -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 \ No newline at end of file +terraform: https://github.com/systemaccounting/mxfactorial/blob/develop/infra/terraform/aws/modules/environment/v001/go-migrate.tf \ No newline at end of file diff --git a/migrations/makefile b/migrations/makefile index 3ff214b18..d2bd0681f 100644 --- a/migrations/makefile +++ b/migrations/makefile @@ -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' \ diff --git a/project.yaml b/project.yaml index 7364076a9..dbf4cc72e 100644 --- a/project.yaml +++ b/project.yaml @@ -96,7 +96,7 @@ docker: LOCAL_TAG_VERSION: ssm: null default: latest -infrastructure: +infra: terraform: env_var: set: diff --git a/scripts/README.md b/scripts/README.md index 1994af0e1..2f70c9bf2 100755 --- a/scripts/README.md +++ b/scripts/README.md @@ -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: @@ -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 @@ -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` @@ -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 diff --git a/scripts/auth-ecr.sh b/scripts/auth-ecr.sh index 6e97aa1e7..bbb47be75 100644 --- a/scripts/auth-ecr.sh +++ b/scripts/auth-ecr.sh @@ -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 \ No newline at end of file diff --git a/scripts/build-all-images.sh b/scripts/build-all-images.sh index b2bbb4a0b..5739df009 100644 --- a/scripts/build-all-images.sh +++ b/scripts/build-all-images.sh @@ -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 diff --git a/scripts/build-dev-env.sh b/scripts/build-dev-env.sh index 0725dd3a9..e294d1764 100644 --- a/scripts/build-dev-env.sh +++ b/scripts/build-dev-env.sh @@ -8,8 +8,8 @@ BUILD_START_TIME=$(date +%s) ENV=dev PROJECT_CONF=project.yaml -REGION=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF) -TFSTATE_BUCKET_PREFIX=$(yq '.infrastructure.terraform.aws.modules["project-storage"].env_var.set.TFSTATE_BUCKET_PREFIX.default' $PROJECT_CONF) +REGION=$(yq '.infra.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF) +TFSTATE_BUCKET_PREFIX=$(yq '.infra.terraform.aws.modules["project-storage"].env_var.set.TFSTATE_BUCKET_PREFIX.default' $PROJECT_CONF) ENV_FILE_NAME=$(yq '.env_var.set.ENV_FILE_NAME.default' $PROJECT_CONF) ENV_FILE=$ENV_FILE_NAME @@ -23,17 +23,17 @@ if [[ -z $ENV_ID ]]; then fi ENV_ID=$(source ./scripts/print-env-id.sh) -TFSTATE_EXT=$(yq '.infrastructure.terraform.env_var.set.TFSTATE_EXT.default' $PROJECT_CONF) -TFSTATE_APIGW_SUFFIX=$(yq '.infrastructure.terraform.aws.environments.region.env_var.set.TFSTATE_APIGW_SUFFIX.default' $PROJECT_CONF) +TFSTATE_EXT=$(yq '.infra.terraform.env_var.set.TFSTATE_EXT.default' $PROJECT_CONF) +TFSTATE_APIGW_SUFFIX=$(yq '.infra.terraform.aws.environments.region.env_var.set.TFSTATE_APIGW_SUFFIX.default' $PROJECT_CONF) TFSTATE_APIGW="$TFSTATE_APIGW_SUFFIX".$TFSTATE_EXT -TFSTATE_ENV_SUFFIX=$(yq '.infrastructure.terraform.env_var.set.TFSTATE_ENV_SUFFIX.default' $PROJECT_CONF) +TFSTATE_ENV_SUFFIX=$(yq '.infra.terraform.env_var.set.TFSTATE_ENV_SUFFIX.default' $PROJECT_CONF) TFSTATE_ENV="$TFSTATE_ENV_SUFFIX".$TFSTATE_EXT ID_ENV="$ENV_ID-$ENV" TFSTATE_BUCKET="$TFSTATE_BUCKET_PREFIX-$ID_ENV" TFPLAN_FILE=.tfplan -pushd infrastructure/terraform/aws/environments/init-dev +pushd infra/terraform/aws/environments/init-dev terraform init @@ -46,9 +46,9 @@ function apply_agigw_logging_perm() { source ./scripts/terraform-init-dev.sh \ --key "$TFSTATE_APIGW" \ - --dir infrastructure/terraform/aws/environments/region + --dir infra/terraform/aws/environments/region - pushd infrastructure/terraform/aws/environments/region + pushd infra/terraform/aws/environments/region printf "\n${YELLOW}*** provisioning $ID_ENV api gateway logging permission and saving in $TFSTATE_APIGW${NOCOLOR}\n\n" terraform apply @@ -84,9 +84,9 @@ make --no-print-directory all CMD=initial-deploy ENV=dev source ./scripts/terraform-init-dev.sh \ --key "$TFSTATE_ENV" \ - --dir infrastructure/terraform/aws/environments/dev + --dir infra/terraform/aws/environments/dev -pushd infrastructure/terraform/aws/environments/dev +pushd infra/terraform/aws/environments/dev printf "\n${YELLOW}*** creating terraform plan for $ID_ENV infrastructure${NOCOLOR}\n\n" terraform plan -out $TFPLAN_FILE diff --git a/scripts/build-image-job.sh b/scripts/build-image-job.sh index 481ef9e87..63a8ecfe2 100644 --- a/scripts/build-image-job.sh +++ b/scripts/build-image-job.sh @@ -23,10 +23,10 @@ while [[ "$#" -gt 0 ]]; do done 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) ENV=dev ID_ENV="$ENV_ID-$ENV" -ARTIFACTS_BUCKET_PREFIX=$(yq '.infrastructure.terraform.aws.modules["project-storage"].env_var.set.ARTIFACTS_BUCKET_PREFIX.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" SERVICES_ZIP=$(yq '.scripts.env_var.set.SERVICES_ZIP.default' $PROJECT_CONF) SERVICES_DIR=$(echo $SERVICES_ZIP | sed 's/.zip//') diff --git a/scripts/configure-aws-build.sh b/scripts/configure-aws-build.sh index 277245765..8d65f5d62 100644 --- a/scripts/configure-aws-build.sh +++ b/scripts/configure-aws-build.sh @@ -12,11 +12,11 @@ PROJECT_CONF=project.yaml ENV_FILE_NAME=$(yq '.env_var.set.ENV_FILE_NAME.default' $PROJECT_CONF) ENV_FILE=$ENV_FILE_NAME -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) IAM_USER=$(yq '.scripts.env_var.set.IAM_USER.default' $PROJECT_CONF) -TFSTATE_INIT_DEV=infrastructure/terraform/aws/environments/init-dev/terraform.tfstate -DEV_ENV_DIR=infrastructure/terraform/aws/environments/dev +TFSTATE_INIT_DEV=infra/terraform/aws/environments/init-dev/terraform.tfstate +DEV_ENV_DIR=infra/terraform/aws/environments/dev TFSTATE_DEV="$DEV_ENV_DIR/.terraform/terraform.tfstate" aws configure set default.region "$REGION" diff --git a/scripts/create-env-file.sh b/scripts/create-env-file.sh index d30160585..3b49951a3 100644 --- a/scripts/create-env-file.sh +++ b/scripts/create-env-file.sh @@ -57,11 +57,11 @@ if [[ $ENV != 'local' ]]; then ENV_ID=$(source scripts/print-env-id.sh) fi -SSM_VERSION=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.SSM_VERSION.default' $PROJECT_CONF) -REGION=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF) +SSM_VERSION=$(yq '.infra.terraform.aws.modules.environment.env_var.set.SSM_VERSION.default' $PROJECT_CONF) +REGION=$(yq '.infra.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF) SECRETS=($(yq "$APP_CONF_PATH.env_var.get | join(\" \")" $PROJECT_CONF)) PARAMS=($(yq "$APP_CONF_PATH.params | join(\" \")" $PROJECT_CONF)) -ENABLE_API_AUTH=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.ENABLE_API_AUTH.default' $PROJECT_CONF) +ENABLE_API_AUTH=$(yq '.infra.terraform.aws.modules.environment.env_var.set.ENABLE_API_AUTH.default' $PROJECT_CONF) ENV_FILE_NAME=$(yq '.env_var.set.ENV_FILE_NAME.default' $PROJECT_CONF) ENV_FILE="$APP_DIR_PATH/$ENV_FILE_NAME" LOCAL_ADDRESS=$(yq '.env_var.set.LOCAL_ADDRESS.default' $PROJECT_CONF) diff --git a/scripts/delete-api-log-perms.sh b/scripts/delete-api-log-perms.sh index 9c92260e6..4048d5541 100644 --- a/scripts/delete-api-log-perms.sh +++ b/scripts/delete-api-log-perms.sh @@ -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) GITHUB_REPO_NAME=$(yq '.[".github"].env_var.set.GITHUB_REPO_NAME.default' $PROJECT_CONF) PROJECT_NAME=$GITHUB_REPO_NAME diff --git a/scripts/delete-dev-env.sh b/scripts/delete-dev-env.sh index bb567b247..e0b111dd0 100644 --- a/scripts/delete-dev-env.sh +++ b/scripts/delete-dev-env.sh @@ -28,13 +28,13 @@ if [[ -z $ENV_ID ]]; then exit 1 fi -pushd infrastructure/terraform/aws/environments/dev +pushd infra/terraform/aws/environments/dev terraform destroy --auto-approve && rm -rf .terraform* .tfplan* popd -pushd infrastructure/terraform/aws/environments/region +pushd infra/terraform/aws/environments/region # skip if api gateway logging permission not managed by local terraform if [[ -f terraform.tfstate ]]; then diff --git a/scripts/delete-dev-storage.sh b/scripts/delete-dev-storage.sh index 459ada105..d30b0fbdb 100644 --- a/scripts/delete-dev-storage.sh +++ b/scripts/delete-dev-storage.sh @@ -2,13 +2,13 @@ ENV=dev # hardcoding intended 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) ENV_ID=$(source ./scripts/print-env-id.sh) ID_ENV="$ENV_ID-$ENV" -ARTIFACTS_BUCKET_PREFIX=$(yq '.infrastructure.terraform.aws.modules["project-storage"].env_var.set.ARTIFACTS_BUCKET_PREFIX.default' $PROJECT_CONF) -CLIENT_ORIGIN_BUCKET_PREFIX=$(yq '.infrastructure.terraform.aws.modules["project-storage"].env_var.set.CLIENT_ORIGIN_BUCKET_PREFIX.default' $PROJECT_CONF) -TFSTATE_BUCKET_PREFIX=$(yq '.infrastructure.terraform.aws.modules["project-storage"].env_var.set.TFSTATE_BUCKET_PREFIX.default' $PROJECT_CONF) -DDB_TABLE_NAME_PREFIX=$(yq '.infrastructure.terraform.aws.modules["project-storage"].env_var.set.DDB_TABLE_NAME_PREFIX.default' $PROJECT_CONF) +ARTIFACTS_BUCKET_PREFIX=$(yq '.infra.terraform.aws.modules["project-storage"].env_var.set.ARTIFACTS_BUCKET_PREFIX.default' $PROJECT_CONF) +CLIENT_ORIGIN_BUCKET_PREFIX=$(yq '.infra.terraform.aws.modules["project-storage"].env_var.set.CLIENT_ORIGIN_BUCKET_PREFIX.default' $PROJECT_CONF) +TFSTATE_BUCKET_PREFIX=$(yq '.infra.terraform.aws.modules["project-storage"].env_var.set.TFSTATE_BUCKET_PREFIX.default' $PROJECT_CONF) +DDB_TABLE_NAME_PREFIX=$(yq '.infra.terraform.aws.modules["project-storage"].env_var.set.DDB_TABLE_NAME_PREFIX.default' $PROJECT_CONF) LOCAL_TFSTATE_FILE=terraform.tfstate ARTIFACTS_BUCKET="$ARTIFACTS_BUCKET_PREFIX-$ID_ENV" @@ -16,7 +16,7 @@ CLIENT_ORIGIN_BUCKET="$CLIENT_ORIGIN_BUCKET_PREFIX-$ID_ENV" TFSTATE_BUCKET="$TFSTATE_BUCKET_PREFIX-$ID_ENV" DDB_TABLE="$DDB_TABLE_NAME_PREFIX-$ID_ENV" -INIT_DEV_DIR=infrastructure/terraform/aws/environments/init-dev +INIT_DEV_DIR=infra/terraform/aws/environments/init-dev export AWS_DEFAULT_REGION="$REGION" diff --git a/scripts/delete-ecr-repos.sh b/scripts/delete-ecr-repos.sh index dbe532212..3c1fd70d1 100644 --- a/scripts/delete-ecr-repos.sh +++ b/scripts/delete-ecr-repos.sh @@ -3,7 +3,7 @@ PROJECT_CONF=project.yaml ENV=dev ENV_ID=$(source scripts/print-env-id.sh) -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) for APP_NAME in $(bash scripts/list-deployments.sh | grep -v client | xargs basename -a); do IMAGE_NAME="$ENV_ID/$ENV/$APP_NAME" diff --git a/scripts/deploy-all-images.sh b/scripts/deploy-all-images.sh index 546f6b13c..c2d172515 100644 --- a/scripts/deploy-all-images.sh +++ b/scripts/deploy-all-images.sh @@ -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" DEPLOY_IMAGE_WORKFLOW=$(yq '.[".github"].workflows.env_var.set.DEPLOY_IMAGE_WORKFLOW.default' $PROJECT_CONF) WORKFLOW_ID=$DEPLOY_IMAGE_WORKFLOW diff --git a/scripts/deploy-dev-image.sh b/scripts/deploy-dev-image.sh index 1f66842bb..8565af138 100644 --- a/scripts/deploy-dev-image.sh +++ b/scripts/deploy-dev-image.sh @@ -19,7 +19,7 @@ while [[ "$#" -gt 0 ]]; do done 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) ENV=dev ENV_ID=$(source scripts/print-env-id.sh) ID_ENV="$ENV_ID/$ENV" diff --git a/scripts/deploy-image-job.sh b/scripts/deploy-image-job.sh index 6edd57018..e9b1ee80d 100644 --- a/scripts/deploy-image-job.sh +++ b/scripts/deploy-image-job.sh @@ -22,10 +22,10 @@ while [[ "$#" -gt 0 ]]; do done 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) ENV=dev ID_ENV="$ENV_ID-$ENV" -ARTIFACTS_BUCKET_PREFIX=$(yq '.infrastructure.terraform.aws.modules["project-storage"].env_var.set.ARTIFACTS_BUCKET_PREFIX.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" SERVICES_ZIP=$(yq '.scripts.env_var.set.SERVICES_ZIP.default' $PROJECT_CONF) PROJECT_DIR=$(echo $SERVICES_ZIP | sed 's/.zip//') diff --git a/scripts/deploy-last-image.sh b/scripts/deploy-last-image.sh index d9bff7fb1..70440cadc 100644 --- a/scripts/deploy-last-image.sh +++ b/scripts/deploy-last-image.sh @@ -21,7 +21,7 @@ done PROJECT_CONF=project.yaml ID_ENV="$ENV_ID-$ENV" ID_ENV_PREFIX="$ENV_ID/$ENV" -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) IMAGE_NAME="$ID_ENV_PREFIX/$APP_NAME" LAMBDA_NAME="$APP_NAME-$ID_ENV" diff --git a/scripts/dump-db.sh b/scripts/dump-db.sh index b7f56240c..b6cfa8e5d 100644 --- a/scripts/dump-db.sh +++ b/scripts/dump-db.sh @@ -24,7 +24,7 @@ PROJECT_CONF=project.yaml DUMP_PATH=$(yq '.migrations.dumps.env_var.set.TESTSEED_DUMP_PATH.default' $PROJECT_CONF) ENV_FILE_NAME=$(yq '.env_var.set.ENV_FILE_NAME.default' $PROJECT_CONF) ENV_FILE="$ENV_FILE_NAME" -PG_CONF_PATH='.infrastructure.terraform.aws.modules.environment.env_var.set' +PG_CONF_PATH='.infra.terraform.aws.modules.environment.env_var.set' if [[ $DUMP_RDS ]]; then pushd migrations >/dev/null diff --git a/scripts/encode-client-env.sh b/scripts/encode-client-env.sh index 61b44c4b3..71c87c33c 100644 --- a/scripts/encode-client-env.sh +++ b/scripts/encode-client-env.sh @@ -3,7 +3,7 @@ PROJECT_CONF=project.yaml ENV_FILE_NAME=$(yq '.env_var.set.ENV_FILE_NAME.default' $PROJECT_CONF) ENV_FILE="$ENV_FILE_NAME" -ENABLE_API_AUTH=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.ENABLE_API_AUTH.default' $PROJECT_CONF) +ENABLE_API_AUTH=$(yq '.infra.terraform.aws.modules.environment.env_var.set.ENABLE_API_AUTH.default' $PROJECT_CONF) cd client diff --git a/scripts/get-ssh-key.sh b/scripts/get-ssh-key.sh index 42d021e26..97e507922 100644 --- a/scripts/get-ssh-key.sh +++ b/scripts/get-ssh-key.sh @@ -32,8 +32,8 @@ done PROJECT_CONF=project.yaml ENV_ID=$(source scripts/print-env-id.sh) ID_ENV="$ENV_ID-$ENV" -SSM_VERSION=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.SSM_VERSION.default' $PROJECT_CONF) -REGION=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF) +SSM_VERSION=$(yq '.infra.terraform.aws.modules.environment.env_var.set.SSM_VERSION.default' $PROJECT_CONF) +REGION=$(yq '.infra.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF) KEY_PATH="$DIR/$ID_ENV.pem" if [[ -f $KEY_PATH ]]; then diff --git a/scripts/import-tf-init-env.sh b/scripts/import-tf-init-env.sh index 8f5730c72..474577912 100644 --- a/scripts/import-tf-init-env.sh +++ b/scripts/import-tf-init-env.sh @@ -22,7 +22,7 @@ ENV_ID=$(source scripts/print-env-id.sh) ID_ENV="$ENV_ID-$ENV" -cd infrastructure/terraform/aws/environments/init-$ENV +cd infra/terraform/aws/environments/init-$ENV terraform init diff --git a/scripts/insert-transactions.sh b/scripts/insert-transactions.sh index 8e2ec613a..9070574c8 100644 --- a/scripts/insert-transactions.sh +++ b/scripts/insert-transactions.sh @@ -39,7 +39,7 @@ TEST_DATA_FILE_LENGTH=$(yq -o=json 'length' $TEST_DATA_FILE) MIGRATIONS_DIR=./migrations TEST_ENV=dev -ENV_VAR_PATH='infrastructure.terraform.aws.modules.environment.env_var.set' +ENV_VAR_PATH='infra.terraform.aws.modules.environment.env_var.set' export PGDATABASE=$(yq ".${ENV_VAR_PATH}.PGDATABASE.default" $PROJECT_CONF) export PGUSER=$(yq ".${ENV_VAR_PATH}.PGUSER.default" $PROJECT_CONF) export PGPASSWORD=$(yq ".${ENV_VAR_PATH}.PGPASSWORD.default" $PROJECT_CONF) diff --git a/scripts/invoke-function.sh b/scripts/invoke-function.sh index 4d5ff9de2..c1259e870 100644 --- a/scripts/invoke-function.sh +++ b/scripts/invoke-function.sh @@ -35,7 +35,7 @@ LAMBDA_INVOKE_LOG_FILE_NAME=$(yq '.services.env_var.set.LAMBDA_INVOKE_LOG.defaul LAMBDA_INVOKE_LOG="$LAMBDA_INVOKE_LOG_FILE_PATH/$LAMBDA_INVOKE_LOG_FILE_NAME" -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 lambda invoke \ --region $REGION \ diff --git a/scripts/list-lambdas.sh b/scripts/list-lambdas.sh index 036357552..2c018fdee 100644 --- a/scripts/list-lambdas.sh +++ b/scripts/list-lambdas.sh @@ -19,7 +19,7 @@ done PROJECT_CONF=project.yaml ENV_ID=$(source scripts/print-env-id.sh) -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) UNSORTED_FUNCTIONS=($(aws lambda list-functions \ --region $REGION \ diff --git a/scripts/manage-gitpod-iam.sh b/scripts/manage-gitpod-iam.sh index 9ef2cac38..d0dd2a57b 100644 --- a/scripts/manage-gitpod-iam.sh +++ b/scripts/manage-gitpod-iam.sh @@ -15,7 +15,7 @@ while [[ "$#" -gt 0 ]]; do done 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) IAM_USER=$(yq '.scripts.env_var.set.IAM_USER.default' $PROJECT_CONF) USER_POLICY_ARN=$(yq '.scripts.env_var.set.USER_POLICY_ARN.default' $PROJECT_CONF) diff --git a/scripts/manage-rds.sh b/scripts/manage-rds.sh index 231d61200..0cd3d1ee6 100644 --- a/scripts/manage-rds.sh +++ b/scripts/manage-rds.sh @@ -16,10 +16,10 @@ while [[ "$#" -gt 0 ]]; do done 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) ENV_ID=$(source scripts/print-env-id.sh) -RDS_INSTANCE_NAME_PREFIX=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.RDS_INSTANCE_NAME_PREFIX.default' $PROJECT_CONF) +RDS_INSTANCE_NAME_PREFIX=$(yq '.infra.terraform.aws.modules.environment.env_var.set.RDS_INSTANCE_NAME_PREFIX.default' $PROJECT_CONF) RDS_INSTANCE_NAME="$RDS_INSTANCE_NAME_PREFIX-$ENV_ID-$ENV" if [[ "$START" -eq 1 ]]; then diff --git a/scripts/manage-redis.sh b/scripts/manage-redis.sh index 9bb5a4af3..f533b0bf5 100644 --- a/scripts/manage-redis.sh +++ b/scripts/manage-redis.sh @@ -35,7 +35,7 @@ function flush() { REDIS_URI="redis://$REDIS_USERNAME:$REDIS_PASSWORD@$REDIS_HOST:$REDIS_PORT/$REDIS_DB" COMPOSE_PROJECT_NAME=$(yq '.name' ./docker/compose.yaml) CONTAINER_NAME="$COMPOSE_PROJECT_NAME-redis-1" - PGPORT=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.PGPORT.default' $PROJECT_CONF) + PGPORT=$(yq '.infra.terraform.aws.modules.environment.env_var.set.PGPORT.default' $PROJECT_CONF) # test for compose or k8s if [[ "$PGPORT" == "5432" ]]; then diff --git a/scripts/print-ecr-repo-uri.sh b/scripts/print-ecr-repo-uri.sh index 90631ed4c..38a4a58ab 100644 --- a/scripts/print-ecr-repo-uri.sh +++ b/scripts/print-ecr-repo-uri.sh @@ -21,7 +21,7 @@ done PROJECT_CONF=project.yaml ID_ENV_PREFIX="$ENV_ID/$ENV" IMAGE_NAME="$ID_ENV_PREFIX/$APP_NAME" -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 ecr describe-repositories \ --query "repositories[?contains(repositoryUri, \`$IMAGE_NAME\`)].repositoryUri" \ diff --git a/scripts/print-lambda-policy.sh b/scripts/print-lambda-policy.sh index d1d80907b..3c7c749d6 100644 --- a/scripts/print-lambda-policy.sh +++ b/scripts/print-lambda-policy.sh @@ -21,7 +21,7 @@ PROJECT_CONF=project.yaml ENV_ID=$(source scripts/print-env-id.sh) ID_ENV="$ENV_ID-$ENV" LAMBDA_NAME=$APP_NAME-$ID_ENV -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 lambda get-policy \ --function-name "$LAMBDA_NAME" \ diff --git a/scripts/print-value.sh b/scripts/print-value.sh index 6987dc9c7..baf6b9910 100644 --- a/scripts/print-value.sh +++ b/scripts/print-value.sh @@ -15,8 +15,8 @@ while [[ "$#" -gt 0 ]]; do done PROJECT_CONF=project.yaml -SSM_VERSION=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.SSM_VERSION.default' $PROJECT_CONF) -REGION=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF) +SSM_VERSION=$(yq '.infra.terraform.aws.modules.environment.env_var.set.SSM_VERSION.default' $PROJECT_CONF) +REGION=$(yq '.infra.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF) CONF_OBJ=$(yq "... | select(has(\"$VAR\")).$VAR" $PROJECT_CONF) IS_AVAILABLE=$(source scripts/list-env-vars.sh | grep -e "^$VAR$" | wc -l | xargs) diff --git a/scripts/push-prod-image.sh b/scripts/push-prod-image.sh index c6bee3ec3..a33ccd7b6 100644 --- a/scripts/push-prod-image.sh +++ b/scripts/push-prod-image.sh @@ -33,7 +33,7 @@ done PROJECT_CONF=project.yaml ID_ENV="$ENV_ID-$ENV" ID_ENV_PREFIX="$ENV_ID/$ENV" -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) REPO_NAME="$ID_ENV_PREFIX/$APP_NAME" PROD_ENV_ID=$(yq '.env_var.set.PROD_ENV_ID.default' $PROJECT_CONF) SHORT_GIT_SHA_LENGTH=$(yq '.scripts.env_var.set.SHORT_GIT_SHA_LENGTH.default' $PROJECT_CONF) diff --git a/scripts/restore-db.sh b/scripts/restore-db.sh index 84bb250c8..36d7a53d5 100644 --- a/scripts/restore-db.sh +++ b/scripts/restore-db.sh @@ -24,7 +24,7 @@ PROJECT_CONF=project.yaml DUMP_PATH=$(yq '.migrations.dumps.env_var.set.TESTSEED_DUMP_PATH.default' $PROJECT_CONF) ENV_FILE_NAME=$(yq '.env_var.set.ENV_FILE_NAME.default' $PROJECT_CONF) ENV_FILE="$ENV_FILE_NAME" -PG_CONF_PATH='.infrastructure.terraform.aws.modules.environment.env_var.set' +PG_CONF_PATH='.infra.terraform.aws.modules.environment.env_var.set' if [[ $DUMP_RDS ]]; then pushd migrations >/dev/null diff --git a/scripts/set-k8s-ports.sh b/scripts/set-k8s-ports.sh index 60fa7b50d..300936294 100644 --- a/scripts/set-k8s-ports.sh +++ b/scripts/set-k8s-ports.sh @@ -56,7 +56,7 @@ function set() { done # set PGPORT separately to ./k8s/postgres-node-port.yml:spec.ports.containerPort - yq -i ".infrastructure.terraform.aws.modules.environment.env_var.set.PGPORT.default = $pgport" project.yaml + yq -i ".infra.terraform.aws.modules.environment.env_var.set.PGPORT.default = $pgport" project.yaml # remove trailing newline if empty if [[ -z $(tail -c 1 $PROJECT_CONF) ]]; then diff --git a/scripts/tag-merge-commit.sh b/scripts/tag-merge-commit.sh index f7f8562e1..97dc337b5 100644 --- a/scripts/tag-merge-commit.sh +++ b/scripts/tag-merge-commit.sh @@ -33,7 +33,7 @@ done PROJECT_CONF=project.yaml ID_ENV="$ENV_ID-$ENV" ID_ENV_PREFIX="$ENV_ID/$ENV" -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) SHORT_GIT_SHA_LENGTH=$(yq '.scripts.env_var.set.SHORT_GIT_SHA_LENGTH.default' $PROJECT_CONF) IMAGE_NAME="$ID_ENV_PREFIX/$APP_NAME" diff --git a/scripts/terraform-init-dev.sh b/scripts/terraform-init-dev.sh index 836d78c39..757231995 100644 --- a/scripts/terraform-init-dev.sh +++ b/scripts/terraform-init-dev.sh @@ -7,7 +7,7 @@ if [[ "$#" -ne 4 ]]; then use: bash scripts/terraform-init-dev.sh \ --key env_infra.tfstate \ - --dir infrastructure/terraform/aws/environments/dev + --dir infra/terraform/aws/environments/dev EOF exit 1 fi @@ -23,8 +23,8 @@ done ENV=dev PROJECT_CONF=project.yaml -REGION=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF) -TFSTATE_BUCKET_PREFIX=$(yq '.infrastructure.terraform.aws.modules["project-storage"].env_var.set.TFSTATE_BUCKET_PREFIX.default' $PROJECT_CONF) +REGION=$(yq '.infra.terraform.aws.modules.environment.env_var.set.REGION.default' $PROJECT_CONF) +TFSTATE_BUCKET_PREFIX=$(yq '.infra.terraform.aws.modules["project-storage"].env_var.set.TFSTATE_BUCKET_PREFIX.default' $PROJECT_CONF) ENV_FILE_NAME=$(yq '.env_var.set.ENV_FILE_NAME.default' $PROJECT_CONF) ENV_FILE=$ENV_FILE_NAME diff --git a/scripts/update-function-image.sh b/scripts/update-function-image.sh index 25273c2c3..79e14fe93 100644 --- a/scripts/update-function-image.sh +++ b/scripts/update-function-image.sh @@ -27,7 +27,7 @@ PROJECT_CONF=project.yaml ENV_ID=$(source scripts/print-env-id.sh) ID_ENV="$ENV_ID-$ENV" LAMBDA_NAME="$APP_NAME-$ID_ENV" -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) LAST_MOD=$(aws lambda update-function-code \ --function-name="$LAMBDA_NAME" \ diff --git a/scripts/watch-redis-key.sh b/scripts/watch-redis-key.sh index c5ded3631..b1467c1e0 100644 --- a/scripts/watch-redis-key.sh +++ b/scripts/watch-redis-key.sh @@ -45,7 +45,7 @@ REDIS_HOST=$(yq '.services.event.env_var.set.REDIS_HOST.default' $PROJECT_CONF) REDIS_URI="redis://$REDIS_USERNAME:$REDIS_PASSWORD@$REDIS_HOST:$REDIS_PORT/$REDIS_DB" COMPOSE_PROJECT_NAME=$(yq '.name' ./docker/compose.yaml) CONTAINER_NAME="$COMPOSE_PROJECT_NAME-redis-1" -PGPORT=$(yq '.infrastructure.terraform.aws.modules.environment.env_var.set.PGPORT.default' $PROJECT_CONF) +PGPORT=$(yq '.infra.terraform.aws.modules.environment.env_var.set.PGPORT.default' $PROJECT_CONF) # reset ports if k8s if [[ $(kubectl get pods | wc -l | xargs) -gt 3 ]]; then diff --git a/services/auto-confirm/README.md b/services/auto-confirm/README.md index d93ed914e..abaa4df3f 100644 --- a/services/auto-confirm/README.md +++ b/services/auto-confirm/README.md @@ -12,4 +12,4 @@ deploy: `make deploy ENV=dev` -terraform: https://github.com/systemaccounting/mxfactorial/blob/8c92e48e04af73ed700b2471a05f6b0ee76c0912/infrastructure/terraform/aws/modules/environment/v001/lambda-services.tf#L105-L114 \ No newline at end of file +terraform: https://github.com/systemaccounting/mxfactorial/blob/d45b5dcb214eddb531819d2206786fbdd5c9033a/infra/terraform/aws/modules/environment/v001/lambda-services.tf#L134-L144 \ No newline at end of file diff --git a/services/balance-by-account/README.md b/services/balance-by-account/README.md index f14e52dc3..9b8c057a0 100644 --- a/services/balance-by-account/README.md +++ b/services/balance-by-account/README.md @@ -10,4 +10,4 @@ deploy: `make deploy ENV=dev` -terraform: https://github.com/systemaccounting/mxfactorial/blob/8c92e48e04af73ed700b2471a05f6b0ee76c0912/infrastructure/terraform/aws/modules/environment/v001/lambda-services.tf#L96-L103 +terraform: https://github.com/systemaccounting/mxfactorial/blob/d45b5dcb214eddb531819d2206786fbdd5c9033a/infra/terraform/aws/modules/environment/v001/lambda-services.tf#L70-L80 diff --git a/services/graphql/README.md b/services/graphql/README.md index c79cabcda..4c571adeb 100644 --- a/services/graphql/README.md +++ b/services/graphql/README.md @@ -31,4 +31,4 @@ query variables: #### clean 1. `make clean` -terraform: https://github.com/systemaccounting/mxfactorial/blob/develop/infrastructure/terraform/aws/modules/environment/v001/graphql.tf \ No newline at end of file +terraform: https://github.com/systemaccounting/mxfactorial/blob/d45b5dcb214eddb531819d2206786fbdd5c9033a/infra/terraform/aws/modules/environment/v001/lambda-services.tf#L3-L24 \ No newline at end of file diff --git a/services/request-approve/README.md b/services/request-approve/README.md index ace9cc0f0..e57ddc40f 100644 --- a/services/request-approve/README.md +++ b/services/request-approve/README.md @@ -96,4 +96,4 @@ all account balances referenced in `transaction_items` are changed when a `trans ### infra -terraform: https://github.com/systemaccounting/mxfactorial/blob/8c92e48e04af73ed700b2471a05f6b0ee76c0912/infrastructure/terraform/aws/modules/environment/v001/lambda-services.tf#L44-L54 \ No newline at end of file +terraform: https://github.com/systemaccounting/mxfactorial/blob/d45b5dcb214eddb531819d2206786fbdd5c9033a/infra/terraform/aws/modules/environment/v001/lambda-services.tf#L57-L68 \ No newline at end of file diff --git a/services/request-by-id/README.md b/services/request-by-id/README.md index 5bd042da2..d527cda0e 100644 --- a/services/request-by-id/README.md +++ b/services/request-by-id/README.md @@ -12,4 +12,4 @@ deploy: `make deploy ENV=dev` -terraform: https://github.com/systemaccounting/mxfactorial/blob/8c92e48e04af73ed700b2471a05f6b0ee76c0912/infrastructure/terraform/aws/modules/environment/v001/lambda-services.tf#L67-L74 \ No newline at end of file +terraform: https://github.com/systemaccounting/mxfactorial/blob/d45b5dcb214eddb531819d2206786fbdd5c9033a/infra/terraform/aws/modules/environment/v001/lambda-services.tf#L96-L106 \ No newline at end of file diff --git a/services/request-create/README.md b/services/request-create/README.md index 2b2718934..edc0f7640 100644 --- a/services/request-create/README.md +++ b/services/request-create/README.md @@ -118,4 +118,4 @@ the `request-create` service: ### infra -terraform: https://github.com/systemaccounting/mxfactorial/blob/8c92e48e04af73ed700b2471a05f6b0ee76c0912/infrastructure/terraform/aws/modules/environment/v001/lambda-services.tf#L3-L14 \ No newline at end of file +terraform: https://github.com/systemaccounting/mxfactorial/blob/d45b5dcb214eddb531819d2206786fbdd5c9033a/infra/terraform/aws/modules/environment/v001/lambda-services.tf#L42-L55 \ No newline at end of file diff --git a/services/requests-by-account/README.md b/services/requests-by-account/README.md index 8a7351ca5..a51a65fdd 100644 --- a/services/requests-by-account/README.md +++ b/services/requests-by-account/README.md @@ -12,4 +12,4 @@ deploy: `make deploy ENV=dev` -terraform: https://github.com/systemaccounting/mxfactorial/blob/8c92e48e04af73ed700b2471a05f6b0ee76c0912/infrastructure/terraform/aws/modules/environment/v001/lambda-services.tf#L56-L65 \ No newline at end of file +terraform: https://github.com/systemaccounting/mxfactorial/blob/d45b5dcb214eddb531819d2206786fbdd5c9033a/infra/terraform/aws/modules/environment/v001/lambda-services.tf#L82-L94 \ No newline at end of file diff --git a/services/rule/README.md b/services/rule/README.md index 67336caaf..9198db1e5 100644 --- a/services/rule/README.md +++ b/services/rule/README.md @@ -220,4 +220,4 @@ the rule service returns a `transaction` object with `transaction_items` listing ### prepare for terraform `make initial-deploy ENV=dev` to zip and put source in s3 only -terraform: https://github.com/systemaccounting/mxfactorial/blob/develop/infrastructure/terraform/aws/modules/environment/v001/lambda-services.tf#L215-L234 \ No newline at end of file +terraform: https://github.com/systemaccounting/mxfactorial/blob/d45b5dcb214eddb531819d2206786fbdd5c9033a/infra/terraform/aws/modules/environment/v001/lambda-services.tf#L26-L40 \ No newline at end of file diff --git a/services/transaction-by-id/README.md b/services/transaction-by-id/README.md index ee9159756..399926a60 100644 --- a/services/transaction-by-id/README.md +++ b/services/transaction-by-id/README.md @@ -10,4 +10,4 @@ deploy: `make deploy ENV=dev` -terraform: https://github.com/systemaccounting/mxfactorial/blob/develop/infrastructure/terraform/aws/modules/environment/v001/lambda-services.tf#L87-L94 \ No newline at end of file +terraform: https://github.com/systemaccounting/mxfactorial/blob/d45b5dcb214eddb531819d2206786fbdd5c9033a/infra/terraform/aws/modules/environment/v001/lambda-services.tf#L122-L132 \ No newline at end of file diff --git a/services/transactions-by-account/README.md b/services/transactions-by-account/README.md index 2d5cc579e..ab549ecbf 100644 --- a/services/transactions-by-account/README.md +++ b/services/transactions-by-account/README.md @@ -10,4 +10,4 @@ deploy: `make deploy ENV=dev` -terraform: https://github.com/systemaccounting/mxfactorial/blob/develop/infrastructure/terraform/aws/modules/environment/v001/lambda-services.tf#L76-L85 \ No newline at end of file +terraform: https://github.com/systemaccounting/mxfactorial/blob/d45b5dcb214eddb531819d2206786fbdd5c9033a/infra/terraform/aws/modules/environment/v001/lambda-services.tf#L108-L120 \ No newline at end of file