generated from terraform-modules/template_aws_module
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
89 additions
and
12 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 |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| data "aws_subnets" "container_subnets" { | ||
| filter { | ||
| name = "vpc-id" | ||
| values = [local.vpc_id] | ||
| } | ||
| filter { | ||
| name = "tag:Name" | ||
| values = [var.ecs_container_subnet_filter] | ||
| } | ||
| } | ||
|
|
||
| data "aws_subnet" "container_subnets" { | ||
| for_each = toset(data.aws_subnets.container_subnets.ids) | ||
| id = each.key | ||
| } | ||
|
|
||
| data "aws_subnets" "apps_subnets" { | ||
| filter { | ||
| name = "vpc-id" | ||
| values = [local.vpc_id] | ||
| } | ||
| filter { | ||
| name = "tag:Name" | ||
| values = [var.ecs_apps_subnet_filter] | ||
| } | ||
| } | ||
|
|
||
| data "aws_subnet" "apps_subnets" { | ||
| for_each = toset(data.aws_subnets.apps_subnets.ids) | ||
| id = each.key | ||
| } | ||
|
|
||
| data "aws_subnets" "lb_subnets" { | ||
| filter { | ||
| name = "vpc-id" | ||
| values = [local.vpc_id] | ||
| } | ||
| filter { | ||
| name = "tag:Name" | ||
| values = [var.ecs_lb_subnet_filter] | ||
| } | ||
| } | ||
|
|
||
| data "aws_subnet" "lb_subnets" { | ||
| for_each = toset(data.aws_subnets.lb_subnets.ids) | ||
| id = each.key | ||
| } |
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,18 +1,17 @@ | ||
| locals { | ||
| region = var.region | ||
| app_program = "dice" | ||
| app_project = "mojo" | ||
| app_environment = "dev" | ||
|
|
||
| vpc_id = data.terraform_remote_state.vpc_east_vpc2.outputs.vpc_id | ||
| vpc_short_name = data.terraform_remote_state.vpc_east_vpc2.outputs.vpc_info["vpc_short_name"] | ||
| sg_web_id = data.terraform_remote_state.vpc_east_vpc2.outputs.sg_web_id | ||
| apps_subnet_ids = [for s in data.terraform_remote_state.vpc_east_vpc2.outputs.private_subnets_ids : s.id if length(regexall("^apps-", s.label)) > 0] | ||
| lb_subnet_ids = [for s in data.terraform_remote_state.vpc_east_vpc2.outputs.private_subnets_ids : s.id if length(regexall("^private-lb-", s.label)) > 0] | ||
| ecs_cluster_id = data.terraform_remote_state.vpc_east_vpc2_apps_dice-ecs-fargate.outputs.ecs_cluster_id | ||
|
|
||
| base_tags = { | ||
| "boc:created_by" = "terraform" | ||
| "CostAllocation" = format("%v:%v:%v", local.app_program, local.app_environment, local.app_project) | ||
| } | ||
|
|
||
| ecs_cluster_id = data.terraform_remote_state.vpc_east_vpc3_apps_dice-ecs-fargate.outputs.ecs_cluster_id | ||
| vpc_details = data.terraform_remote_state.vpc_east_vpc3.outputs | ||
| vpc_info = local.vpc_details.vpc_info | ||
| vpc_id = local.vpc_info["vpc_id"] | ||
| vpc_short_name = local.vpc_info["vpc_short_name"] | ||
| sg_web_id = local.vpc_details.sg_web_id | ||
| log_bucket_name = format("inf-logs-%v-%v", var.account_id, local.region) | ||
| apps_subnet_ids = tolist(data.aws_subnets.apps_subnets.ids) | ||
| container_subnet_ids = tolist(data.aws_subnets.container_subnets.ids) | ||
| lb_subnet_ids = tolist(data.aws_subnets.lb_subnets.ids) | ||
| } |
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 @@ | ||
| locals { | ||
| 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,4 @@ | ||
| cluster_name = null | ||
| ecs_container_subnet_filter = "*-container-*" | ||
| ecs_apps_subnet_filter = "*-apps-*" | ||
| ecs_lb_subnet_filter = "*-private-lb-*" |
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,24 @@ | ||
| variable "cluster_name" { | ||
| description = "Cluster name of form {program}-{env}-fargate or {org}-{project}-{env}-fargate" | ||
| type = string | ||
| } | ||
| # examples: dice-qa-fargate | ||
| # examples: ditd-gups-test-fargate | ||
|
|
||
| variable "ecs_container_subnet_filter" { | ||
| description = "Container subnet filter (ex., *-container-*) to use to select the container subents in this VPC" | ||
| type = string | ||
| defualt = "*-container-*" | ||
| } | ||
|
|
||
| variable "ecs_apps_subnet_filter" { | ||
| description = "Apps subnet filter (ex., *-apps-*) to use to select the container subents in this VPC" | ||
| type = string | ||
| defualt = "*-apps-*" | ||
| } | ||
|
|
||
| variable "ecs_lb_subnet_filter" { | ||
| description = "Private Load Balancer subnet filter (ex., *-private-lb-*) to use to select the container subents in this VPC" | ||
| type = string | ||
| defualt = "*-private-lb-*" | ||
| } |