-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(refactor): major refactor of ad hoc environment modules
- Loading branch information
1 parent
617b264
commit 2d95d0b
Showing
53 changed files
with
373 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,65 @@ | ||
examples-simple-init: | ||
terraform -chdir=examples/simple init | ||
# commands used for local development | ||
|
||
examples-simple-plan: | ||
terraform -chdir=examples/simple plan | ||
tf-fmt: | ||
terraform fmt -recursive | ||
|
||
tf-validate: | ||
terraform validate | ||
|
||
# ad hoc environment stacks | ||
|
||
# ad hoc base | ||
ad-hoc-base-init: | ||
terraform -chdir=examples/ad-hoc/base init | ||
|
||
ad-hoc-base-plan: | ||
terraform -chdir=examples/ad-hoc/base plan | ||
|
||
examples-simple-apply: | ||
terraform -chdir=examples/simple apply | ||
ad-hoc-base-apply: | ||
terraform -chdir=examples/ad-hoc/base apply | ||
|
||
examples-simple: examples-simple-init examples-simple-plan examples-simple-apply | ||
ad-hoc-base-destroy: | ||
terraform -chdir=examples/ad-hoc/base destroy | ||
|
||
examples-simple-destroy: | ||
terraform -chdir=examples/simple destroy | ||
# ad hoc app | ||
ad-hoc-app-init: | ||
terraform -chdir=examples/ad-hoc/app init | ||
|
||
examples-ad-hoc-init: | ||
terraform -chdir=examples/ad-hoc init -backend-config=backend.config | ||
ad-hoc-app-plan: | ||
terraform -chdir=examples/ad-hoc/app plan | ||
|
||
examples-ad-hoc-plan: | ||
terraform -chdir=examples/ad-hoc plan | ||
ad-hoc-app-apply: | ||
terraform -chdir=examples/ad-hoc/app apply | ||
|
||
examples-ad-hoc-apply: | ||
terraform -chdir=examples/ad-hoc apply | ||
ad-hoc-app-destroy: | ||
terraform -chdir=examples/ad-hoc/app destroy | ||
|
||
# PROD base | ||
# prod environment stacks | ||
|
||
examples-prod-base-init: | ||
# prod base | ||
|
||
prod-base-init: | ||
terraform -chdir=examples/prod/base init | ||
|
||
examples-prod-base-plan: | ||
prod-base-plan: | ||
terraform -chdir=examples/prod/base plan | ||
|
||
examples-prod-base-apply: | ||
prod-base-apply: | ||
terraform -chdir=examples/prod/base apply | ||
|
||
examples-prod-base-destroy: | ||
prod-base-destroy: | ||
terraform -chdir=examples/prod/base destroy | ||
|
||
# PROD app | ||
# prod app | ||
|
||
examples-prod-app-init: | ||
prod-app-init: | ||
TF_LOG=ERROR terraform -chdir=examples/prod/app init 2> logs.txt | ||
|
||
examples-prod-app-plan: | ||
prod-app-plan: | ||
terraform -chdir=examples/prod/app plan | ||
|
||
examples-prod-app-apply: | ||
prod-app-apply: | ||
terraform -chdir=examples/prod/app apply | ||
|
||
examples-prod-app-destroy: | ||
prod-app-destroy: | ||
terraform -chdir=examples/prod/app destroy | ||
|
||
tf-fmt: | ||
terraform fmt -recursive | ||
|
||
tf-validate: | ||
terraform validate |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
terraform { | ||
required_version = ">=1.3.6" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "4.48.0" | ||
} | ||
} | ||
|
||
backend "local" {} | ||
} | ||
|
||
provider "aws" { | ||
region = var.region | ||
} | ||
|
||
data "terraform_remote_state" "this" { | ||
backend = "local" | ||
|
||
config = { | ||
path = "../base/terraform.tfstate" | ||
} | ||
} | ||
|
||
module "main" { | ||
source = "../../../modules/ad-hoc/app" | ||
|
||
vpc_id = data.terraform_remote_state.this.outputs.vpc_id | ||
assets_bucket_name = data.terraform_remote_state.this.outputs.assets_bucket_name | ||
private_subnet_ids = data.terraform_remote_state.this.outputs.private_subnet_ids | ||
app_sg_id = data.terraform_remote_state.this.outputs.app_sg_id | ||
alb_sg_id = data.terraform_remote_state.this.outputs.alb_sg_id | ||
listener_arn = data.terraform_remote_state.this.outputs.listener_arn | ||
alb_dns_name = data.terraform_remote_state.this.outputs.alb_dns_name | ||
service_discovery_namespace_id = data.terraform_remote_state.this.outputs.service_discovery_namespace_id | ||
rds_address = data.terraform_remote_state.this.outputs.rds_address | ||
domain_name = data.terraform_remote_state.this.outputs.domain_name | ||
base_stack_name = data.terraform_remote_state.this.outputs.base_stack_name | ||
region = var.region | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "backend_update_script" { | ||
value = module.main.backend_update_command | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
variable "region" { | ||
default = "us-east-1" | ||
} | ||
|
||
|
||
############################################################################## | ||
# Frontend | ||
############################################################################## | ||
|
||
variable "extra_env_vars" { | ||
description = "User-defined environment variables to pass to the backend service and task containers (api, worker, migrate, etc.)" | ||
type = list(object({ name = string, value = string })) | ||
default = [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
terraform.state | ||
terraform.tfstate | ||
terraform.tfvars | ||
.terraform | ||
terraform.tfstate.backup | ||
backend.config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
terraform { | ||
required_version = ">=1.3.6" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "4.48.0" | ||
} | ||
} | ||
|
||
backend "local" {} | ||
} | ||
|
||
provider "aws" { | ||
region = var.region | ||
} | ||
|
||
module "main" { | ||
source = "../../../modules/ad-hoc/base" | ||
certificate_arn = var.certificate_arn | ||
domain_name = var.domain_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
output "vpc_id" { | ||
value = module.main.vpc_id | ||
} | ||
|
||
output "assets_bucket_name" { | ||
value = module.main.assets_bucket_name | ||
description = "Bucket name used for S3 assets" | ||
} | ||
|
||
output "private_subnet_ids" { | ||
value = module.main.private_subnet_ids | ||
} | ||
|
||
output "app_sg_id" { | ||
value = module.main.app_sg_id | ||
} | ||
|
||
output "alb_sg_id" { | ||
value = module.main.alb_sg_id | ||
} | ||
|
||
output "listener_arn" { | ||
value = module.main.listener_arn | ||
} | ||
|
||
output "alb_dns_name" { | ||
value = module.main.alb_dns_name | ||
} | ||
|
||
output "service_discovery_namespace_id" { | ||
value = module.main.service_discovery_namespace_id | ||
description = "service discovery namespace id" | ||
} | ||
|
||
output "rds_address" { | ||
value = module.main.rds_address | ||
description = "address of the RDS instance" | ||
} | ||
|
||
output "domain_name" { | ||
value = module.main.domain_name | ||
} | ||
|
||
output "base_stack_name" { | ||
value = module.main.base_stack_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
variable "region" { | ||
type = string | ||
default = "us-east-1" | ||
} | ||
|
||
variable "certificate_arn" { | ||
type = string | ||
} | ||
|
||
variable "domain_name" { | ||
description = "Route53 domain name (e.g. example.com)" | ||
type = string | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.