Commit 0ac6c927 authored by David Wolffberg's avatar David Wolffberg Committed by GitHub

feat: add global tags variable to zones (#26)

parent 38ccb0a5
...@@ -36,6 +36,10 @@ module "zones" { ...@@ -36,6 +36,10 @@ module "zones" {
comment = "myapp.com" comment = "myapp.com"
} }
} }
tags = {
ManagedBy = "Terraform"
}
} }
module "records" { module "records" {
......
...@@ -30,6 +30,10 @@ module "zones" { ...@@ -30,6 +30,10 @@ module "zones" {
} }
} }
} }
tags = {
ManagedBy = "Terraform"
}
} }
module "records" { module "records" {
......
...@@ -21,6 +21,7 @@ This module creates Route53 zones. ...@@ -21,6 +21,7 @@ This module creates Route53 zones.
| Name | Description | Type | Default | Required | | Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:| |------|-------------|------|---------|:--------:|
| create | Whether to create Route53 zone | `bool` | `true` | no | | create | Whether to create Route53 zone | `bool` | `true` | no |
| tags | Tags added to all zones. Will take precedence over tags from the 'zones' variable | `map(any)` | `{}` | no |
| zones | Map of Route53 zone parameters | `any` | `{}` | no | | zones | Map of Route53 zone parameters | `any` | `{}` | no |
## Outputs ## Outputs
......
...@@ -14,5 +14,8 @@ resource "aws_route53_zone" "this" { ...@@ -14,5 +14,8 @@ resource "aws_route53_zone" "this" {
} }
} }
tags = lookup(each.value, "tags", null) tags = merge(
lookup(each.value, "tags", {}),
var.tags
)
} }
...@@ -9,3 +9,9 @@ variable "zones" { ...@@ -9,3 +9,9 @@ variable "zones" {
type = any type = any
default = {} default = {}
} }
variable "tags" {
description = "Tags added to all zones. Will take precedence over tags from the 'zones' variable"
type = map(any)
default = {}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment