Skip to content

Commit

Permalink
Add support for tagging policy in compute, database, network and stor…
Browse files Browse the repository at this point in the history
…age (#1236)

* Add support for tagging policy in compute, database, network and storage

* Add tags for QA
  • Loading branch information
avnes authored Dec 14, 2023
1 parent 220a233 commit b8cc5fa
Show file tree
Hide file tree
Showing 21 changed files with 162 additions and 0 deletions.
8 changes: 8 additions & 0 deletions _sub/network/acm-certificate-san/providers.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
provider "aws" {
region = var.aws_region

default_tags {
tags = var.tags
}

assume_role {
role_arn = var.aws_assume_role_arn
}
Expand All @@ -9,4 +13,8 @@ provider "aws" {
provider "aws" {
region = var.aws_region
alias = "core"

default_tags {
tags = var.tags
}
}
6 changes: 6 additions & 0 deletions _sub/network/acm-certificate-san/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ variable "aws_region" {
variable "aws_assume_role_arn" {
type = string
}

variable "tags" {
type = map(string)
description = "A map of tags to apply to all the resources deployed by the module"
default = {}
}
4 changes: 4 additions & 0 deletions compute/ecr-repo/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ terraform {

provider "aws" {
region = var.aws_region

default_tags {
tags = var.tags
}
}
6 changes: 6 additions & 0 deletions compute/ecr-repo/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ variable "scan_on_push" {
type = bool
default = true
}

variable "tags" {
type = map(string)
description = "A map of tags to apply to all the resources deployed by the module"
default = {}
}
4 changes: 4 additions & 0 deletions compute/eks-ec2/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ terraform {
provider "aws" {
region = var.aws_region

default_tags {
tags = var.tags
}

assume_role {
role_arn = var.aws_assume_role_arn
}
Expand Down
6 changes: 6 additions & 0 deletions compute/eks-ec2/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ variable "aws_assume_role_arn" {
type = string
}

variable "tags" {
type = map(string)
description = "A map of tags to apply to all the resources deployed by the module"
default = {}
}

# Optional
# --------------------------------------------------

Expand Down
12 changes: 12 additions & 0 deletions compute/k8s-services/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ terraform {
provider "aws" {
region = var.aws_region

default_tags {
tags = var.tags
}

assume_role {
role_arn = var.aws_assume_role_arn
}
Expand All @@ -14,6 +18,10 @@ provider "aws" {
provider "aws" {
region = var.aws_region
alias = "core"

default_tags {
tags = var.tags
}
}

locals {
Expand All @@ -23,6 +31,10 @@ locals {
provider "aws" {
region = var.aws_region

default_tags {
tags = var.tags
}

assume_role {
role_arn = local.aws_assume_logs_role_arn
}
Expand Down
6 changes: 6 additions & 0 deletions compute/k8s-services/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ variable "workload_dns_zone_name" {
type = string
}

variable "tags" {
type = map(string)
description = "A map of tags to apply to all the resources deployed by the module"
default = {}
}

# Optional
# --------------------------------------------------

Expand Down
5 changes: 5 additions & 0 deletions database/postgres-restore/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ terraform {

provider "aws" {
region = var.aws_region

default_tags {
tags = merge(var.tags, var.data_tags)
}

}
12 changes: 12 additions & 0 deletions database/postgres-restore/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,15 @@ variable "db_publicly_accessible" {
default = true
description = "Should the database be public accessible?"
}

variable "tags" {
type = map(string)
description = "A map of tags to apply to all the resources deployed by the module"
default = {}
}

variable "data_tags" {
type = map(string)
description = "A map of tags to apply to all the data and/or storage deployed by the module"
default = {}
}
5 changes: 5 additions & 0 deletions database/postgres/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ terraform {

provider "aws" {
region = var.aws_region

default_tags {
tags = merge(var.tags, var.data_tags)
}

}
12 changes: 12 additions & 0 deletions database/postgres/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,15 @@ variable "db_publicly_accessible" {
default = true
description = "Should the database be public accessible?"
}

variable "tags" {
type = map(string)
description = "A map of tags to apply to all the resources deployed by the module"
default = {}
}

variable "data_tags" {
type = map(string)
description = "A map of tags to apply to all the data and/or storage deployed by the module"
default = {}
}
8 changes: 8 additions & 0 deletions network/route53-sub-zone/providers.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
provider "aws" {
region = var.aws_region

default_tags {
tags = var.tags
}
}

provider "aws" {
region = var.aws_region
alias = "workload"

default_tags {
tags = var.tags
}

assume_role {
role_arn = "arn:aws:iam::${var.aws_workload_account_id}:role/${var.prime_role_name}"
}
Expand Down
6 changes: 6 additions & 0 deletions network/route53-sub-zone/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ variable "prime_role_name" {
variable "dns_zone_name" {
type = string
}

variable "tags" {
type = map(string)
description = "A map of tags to apply to all the resources deployed by the module"
default = {}
}
4 changes: 4 additions & 0 deletions storage/s3-ce-cli/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ terraform {
provider "aws" {
region = var.aws_region

default_tags {
tags = merge(var.tags, var.data_tags)
}

assume_role {
role_arn = var.aws_assume_role_arn
}
Expand Down
12 changes: 12 additions & 0 deletions storage/s3-ce-cli/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,15 @@ variable "additional_tags" {
type = map(string)
default = {}
}

variable "tags" {
type = map(string)
description = "A map of tags to apply to all the resources deployed by the module"
default = {}
}

variable "data_tags" {
type = map(string)
description = "A map of tags to apply to all the data and/or storage deployed by the module"
default = {}
}
4 changes: 4 additions & 0 deletions storage/s3-eks-public/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ terraform {
provider "aws" {
region = var.aws_region

default_tags {
tags = merge(var.tags, var.data_tags)
}

assume_role {
role_arn = var.aws_assume_role_arn
}
Expand Down
12 changes: 12 additions & 0 deletions storage/s3-eks-public/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,15 @@ variable "eks_is_sandbox" {
type = bool
default = false
}

variable "tags" {
type = map(string)
description = "A map of tags to apply to all the resources deployed by the module"
default = {}
}

variable "data_tags" {
type = map(string)
description = "A map of tags to apply to all the data and/or storage deployed by the module"
default = {}
}
4 changes: 4 additions & 0 deletions storage/s3-velero-backup/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ terraform {
provider "aws" {
region = var.aws_region

default_tags {
tags = merge(var.tags, var.data_tags)
}

assume_role {
role_arn = var.aws_assume_role_arn
}
Expand Down
12 changes: 12 additions & 0 deletions storage/s3-velero-backup/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,15 @@ variable "velero_role_arn" {
type = string
default = null
}

variable "tags" {
type = map(string)
description = "A map of tags to apply to all the resources deployed by the module"
default = {}
}

variable "data_tags" {
type = map(string)
description = "A map of tags to apply to all the data and/or storage deployed by the module"
default = {}
}
14 changes: 14 additions & 0 deletions test/integration/account.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@ terraform_state_region = "eu-central-1"
eks_public_s3_bucket = "dfds-qa-k8s-public"

eks_is_sandbox = true

tags = {
"dfds.owner" = "dfds-qa" # owner set to dummy value on purpose
"dfds.env" = "test"
"dfds.cost.centre" = "ti-arch"
"dfds.service.availability" = "low"
"dfds.automation.tool" = "Terraform"
"dfds.automation.initiator.location" = "https://github.com/dfds/infrastructure-modules"
}

data_tags = {
"dfds.data.backup" = false
"dfds.data.classification" = "private"
}

0 comments on commit b8cc5fa

Please sign in to comment.