Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions templates/terraform/environments/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module "prod" {
project = "<% .Name %>"
region = "<% index .Params `region` %>"
allowed_account_ids = ["<% index .Params `accountId` %>"]
random_seed = "<% index .Params `.randomSeed` %>"

# ECR configuration
ecr_repositories = [] # Should be created by the staging environment
Expand Down
2 changes: 2 additions & 0 deletions templates/terraform/environments/stage/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module "stage" {
project = "<% .Name %>"
region = "<% index .Params `region` %>"
allowed_account_ids = ["<% index .Params `accountId` %>"]
random_seed = "<% index .Params `.randomSeed` %>"

# ECR configuration
ecr_repositories = [ "<% .Name %>" ]

Expand Down
28 changes: 20 additions & 8 deletions templates/terraform/modules/environment/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ data "aws_iam_user" "ci_user" {
user_name = "${var.project}-ci-user" # Should have been created in the bootstrap process
}


module "vpc" {
source = "../../modules/vpc"
source = "commitdev/zero/aws//modules/vpc"
version = "0.0.1"

project = var.project
environment = var.environment
Expand All @@ -24,7 +26,8 @@ data "aws_caller_identity" "current" {}
#
# Provision the EKS cluster
module "eks" {
source = "../../modules/eks"
source = "commitdev/zero/aws//modules/eks"
version = "0.0.1"

project = var.project
environment = var.environment
Expand All @@ -44,23 +47,27 @@ module "eks" {


module "wildcard_domain" {
source = "../../modules/certificate"
source = "commitdev/zero/aws//modules/certificate"
version = "0.0.1"

region = var.region
zone_name = var.domain_name
domain_names = ["*.${var.domain_name}"]
}

module "assets_domains" {
source = "../../modules/certificate"
source = "commitdev/zero/aws//modules/certificate"
version = "0.0.1"

region = "us-east-1" # For CF, the cert must be in us-east-1
zone_name = var.domain_name
domain_names = var.s3_hosting_buckets
}

module "s3_hosting" {
source = "../../modules/s3_hosting"
source = "commitdev/zero/aws//modules/s3_hosting"
version = "0.0.1"

# We need to wait for certificate validation to complete before using the certs
depends_on = [module.assets_domains.certificate_validations]

Expand All @@ -72,27 +79,32 @@ module "s3_hosting" {
}

module "db" {
source = "../../modules/database"
source = "commitdev/zero/aws//modules/database"
version = "0.0.1"

project = var.project
environment = var.environment
vpc_id = module.vpc.vpc_id
password_secret_suffix = var.random_seed
allowed_security_group_id = module.eks.worker_security_group_id
instance_class = var.db_instance_class
storage_gb = var.db_storage_gb
database_engine = var.database
}

module "ecr" {
source = "../../modules/ecr"
source = "commitdev/zero/aws//modules/ecr"
version = "0.0.1"

environment = var.environment
ecr_repositories = var.ecr_repositories
ecr_principals = [data.aws_iam_user.ci_user.arn]
}

module "logging" {
source = "../../modules/logging"
source = "commitdev/zero/aws//modules/logging"
version = "0.0.1"

count = var.logging_type == "kibana" ? 1 : 0

project = var.project
Expand Down