Skip to content

Commit

Permalink
fix(ecs): prefix dev cluster with region
Browse files Browse the repository at this point in the history
Signed-off-by: kolvin <15124052+Kolvin@users.noreply.github.com>
  • Loading branch information
kolvin committed Jun 21, 2023
1 parent aa761fb commit 9b7abeb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
13 changes: 7 additions & 6 deletions common.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ locals {

backend_filename = local.config.terragrunt.backend_filename

tags = merge(
{
Location = "${local.config.base.git_url}/${path_relative_to_include()}"
}
)
default_tags = {
environment = local.account
Location = "${local.config.base.git_url}/${path_relative_to_include()}"
}
}

# DRY terragrunt actions
Expand Down Expand Up @@ -52,7 +51,7 @@ generate "terragrunt_local_vars" {
template_dir = "${get_parent_terragrunt_dir()}/templates"
backend_filename = "${local.backend_filename}"
aws_region = "${local.aws_region}"
account = "${local.account}"
environment = "${local.account}"
}
EOF
}
Expand All @@ -62,6 +61,8 @@ inputs = merge(
{
aws_region = local.aws_region == "global" ? "${local.config.aws.home_region}" : local.aws_region
aws_account_id = local.aws_account_id
environment = local.account
default_tags = local.default_tags
}
)

Expand Down
2 changes: 1 addition & 1 deletion ecs/dev/eu-west-1/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_iam_service_linked_role" "ecs" {
module "ecs" {
source = "git::https://github.com/terraform-aws-modules/terraform-aws-ecs//?ref=v5.2.0"

cluster_name = local.account
cluster_name = "${local.aws_region}-${local.environment}"

# Capacity provider
fargate_capacity_providers = {
Expand Down
16 changes: 15 additions & 1 deletion templates/aws_provider.tf.tpl
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
variable "aws_account_id" {
type = string
description = "wit account we oan"
description = "Wit account we oan"
}

variable "aws_region" {
type = string
description = "Wit region we oan"
}

variable "environment" {
type = string
description = "Freindly name for target account"
}

variable "default_tags" {
type = map(any)
description = "wit region we oan"
}

provider "aws" {
region = var.aws_region
allowed_account_ids = ["${var.aws_account_id}"]
default_tags {
tags = var.default_tags
}
}

0 comments on commit 9b7abeb

Please sign in to comment.