Skip to content

Commit

Permalink
Add multistack monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
kobrikx committed Oct 27, 2022
1 parent f9a8020 commit a77d79a
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 0 deletions.
60 changes: 60 additions & 0 deletions examples/multistack-monorepo/ize.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
aws_region = "us-east-1" # (required) AWS Region of this environment should be specified here. Can be overriden by AWS_PROFILE env var or --aws-region flag.
namespace = "testnut" # (required) Namespace of the project can be specified here. It is used as a base for all naming. It can be overridden by NAMESPACE env var or --namespace flag.
terraform_version = "1.2.6" # (optional) Terraform version can be set here. 1.1.3 by default
# prefer_runtime = "" # (optional) Prefer a specific runtime. (native or docker) (default 'native')
# tag = "" # (optional) Tag can be set statically. Normally it is being constructed automatically based on the git revision.
# plain_text = false # (optional) Plain text output can be enabled here. Default is false. Can be overridden by IZE_PLAIN_TEXT env var or --plain-text-output flag.
# env = "dev" # (optional) Environment name can be specified here. Normally it should be passed via `ENV` variable or --env flag.
# env_dir = "" # (optional) Environment directory can be specified here. Normally it's calculated automatically based on the directory structure convention.
# docker_registry = "" # (optional) Docker registry can be set here. By default it uses ECR repo with the name of the service.
# tf_log_path = "" # (optional) TF_LOG_PATH can be set here.
# custom_prompt = false # (optional) Custom prompt can be enabled here for all console connections. Default: false.
# aws_profile = "" # (optional) AWS Profile can be specified here (but normally it's specified via AWS_PROFILE env var)
# log_level = "" # (optional) Log level can be specified here. Possible levels: info, debug, trace, panic, warn, error, fatal(default). Can be overridden via IZE_LOG_LEVEL env var or via --log-level flag.
# ize_dir = "" # (optional) Ize directory can be specified here. Normally it's assumed to be .infra or .ize in the current repo.
# apps_path = "" # (optional) Path to apps directory can be set. By default apps are searched in 'apps' and 'projects' directories. This is needed in case your repo structure is not purely ize-structured (let's say you have 'src' repo in your dotnet app, as an example)
# root_dir = "" # (optional) Project directory can be set here. By default it's the current directory, but in case you prefer to run ize from the outside of repo it may be useful (uncommon).
# tf_log = "" # (optional) Terraform TF_LOG can be set here. Can be TRACE, DEBUG, INFO, WARN or ERROR.
# config_file = "" # (optional) Path to ize.toml config file can be specified, but normally it's read from the environment's directory automatically.
# home = "" # (optional) User home directory can be specified here. Normally $HOME is used.

[terraform.infra]
aws_region = "us-east-1" # (optional) Terraform-specific AWS Region of this environment should be specified here. Normally global AWS_REGION is used.
# aws_profile = "" # (optional) Terraform-specific AWS profile (optional) can be specified here (but normally it should be inherited from a global AWS_PROFILE).
# version = "" # (optional) Terraform version can be set here. 1.1.3 by default.
# state_bucket_region = "" # (optional) Terraform state bucket region can be specified here. Normally AWS_REGION is used here. Can be overriden via env vars or flags.
# state_bucket_name = "" # (optional) Terraform state bucket name can be specified here. Normally it's generated and defaults to <NAMESPACE>-tf-state
# root_domain_name = "" # (optional) Root domain name can be set here. This is the main domain that will be passed to the terraform. Generally if your app lives at 'api.dev.nutcorp.net' the root domain is `nutcorp.net`

[terraform.vpc]
# aws_profile = "" # (optional) Terraform-specific AWS profile (optional) can be specified here (but normally it should be inherited from a global AWS_PROFILE).
# version = "" # (optional) Terraform version can be set here. 1.1.3 by default.
# state_bucket_region = "" # (optional) Terraform state bucket region can be specified here. Normally AWS_REGION is used here. Can be overriden via env vars or flags.
# state_bucket_name = "" # (optional) Terraform state bucket name can be specified here. Normally it's generated and defaults to <NAMESPACE>-tf-state
# root_domain_name = "" # (optional) Root domain name can be set here. This is the main domain that will be passed to the terraform. Generally if your app lives at 'api.dev.nutcorp.net' the root domain is `nutcorp.net`
depends_on = ["infra"]

[terraform.s3]
# aws_profile = "" # (optional) Terraform-specific AWS profile (optional) can be specified here (but normally it should be inherited from a global AWS_PROFILE).
# version = "" # (optional) Terraform version can be set here. 1.1.3 by default.
# state_bucket_region = "" # (optional) Terraform state bucket region can be specified here. Normally AWS_REGION is used here. Can be overriden via env vars or flags.
# state_bucket_name = "" # (optional) Terraform state bucket name can be specified here. Normally it's generated and defaults to <NAMESPACE>-tf-state
# root_domain_name = "" # (optional) Root domain name can be set here. This is the main domain that will be passed to the terraform. Generally if your app lives at 'api.dev.nutcorp.net' the root domain is `nutcorp.net`
depends_on = ["infra"]

# [ecs.<app>]
# timeout = "" # (optional) ECS deployment timeout can be specified here.
# docker_registry = "" # (optional) Docker registry can be set here. By default it uses ECR repo with the name of the service.
# skip_deploy = false # skip deploy app
# path = "" # (optional) Path to ecs app folder can be specified here. By default it's derived from apps path and app name.
# unsafe = false # (optional) Enables unsafe mode that increases deploy time on a cost of shorter healtchecks.
# image = "" # (optional) Docker image can be specified here. By default it's derived from the app name.
# cluster = "" # (optional) ECS cluster can be specified here. By default it's derived from env & namespace
# task_definition_revision = "" # (optional) Task definition revision can be specified here. By default latest revision is used to perform a deployment. Normally this parameter can be used via cli during specific deployment needs.

# [serverless.<name>]
# node_version = "16" # (optional) Node version that will be used by nvm can be specified here that. Default is v14.
# path = "" # (optional) Path to the serverless app directory can be specified here. Normally it's derived from app directory and app name.
# sls_node_modules_cache_mount = "" # (optional) SLS node_modules cache mount path can be specified here. It's used to store cache during CI/CD process.
# file = "" # (optional) Path to serverless file can be specified here. Normally it's serverless.yml in the app directory.
# create_domain = false # (optional) Create domain for the serverless domain manager during the deployment.
Empty file.
12 changes: 12 additions & 0 deletions examples/multistack-monorepo/s3/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module "s3_bucket" {
source = "registry.terraform.io/terraform-aws-modules/s3-bucket/aws"
version = "~>3.0"

bucket = "${var.env}-${var.namespace}-test-s3-bucket"
acl = "private"

versioning = {
enabled = false
}
force_destroy = true
}
9 changes: 9 additions & 0 deletions examples/multistack-monorepo/s3/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "env" {}
variable "namespace" {}
variable "aws_region" {}

locals {
env = var.env
namespace = var.namespace
aws_region = var.aws_region
}
9 changes: 9 additions & 0 deletions examples/multistack-monorepo/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "env" {}
variable "namespace" {}
variable "aws_region" {}

locals {
env = var.env
namespace = var.namespace
aws_region = var.aws_region
}
32 changes: 32 additions & 0 deletions examples/multistack-monorepo/vpc/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module "vpc" {
source = "registry.terraform.io/terraform-aws-modules/vpc/aws"
version = "~> 3.0"

name = "${var.env}-vpc"
cidr = "10.0.0.0/16"

azs = [
"${var.aws_region}a",
"${var.aws_region}b",

]
public_subnets = [
"10.0.1.0/24",
"10.0.2.0/24"
]

private_subnets = [
"10.0.3.0/24",
"10.0.4.0/24"
]

enable_nat_gateway = true
single_nat_gateway = true
enable_dns_hostnames = true
manage_default_network_acl = true
default_network_acl_name = "${var.env}-${var.namespace}"
tags = {
Terraform = "true"
Env = var.env
}
}
9 changes: 9 additions & 0 deletions examples/multistack-monorepo/vpc/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "env" {}
variable "namespace" {}
variable "aws_region" {}

locals {
env = var.env
namespace = var.namespace
aws_region = var.aws_region
}

0 comments on commit a77d79a

Please sign in to comment.