Skip to content

Commit 1537e47

Browse files
authored
Fix attributes (#15)
1 parent 341e27e commit 1537e47

File tree

2 files changed

+37
-16
lines changed

2 files changed

+37
-16
lines changed

main.tf

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module "origin_label" {
2-
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.1"
2+
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
33
namespace = "${var.namespace}"
44
stage = "${var.stage}"
55
name = "${var.name}"
66
delimiter = "${var.delimiter}"
7-
attributes = ["origin"]
7+
attributes = ["${compact(concat(var.attributes, list("origin")))}"]
88
tags = "${var.tags}"
99
}
1010

@@ -70,7 +70,7 @@ module "logs" {
7070
stage = "${var.stage}"
7171
name = "${var.name}"
7272
delimiter = "${var.delimiter}"
73-
attributes = ["logs"]
73+
attributes = ["${compact(concat(var.attributes, list("logs")))}"]
7474
tags = "${var.tags}"
7575
prefix = "${var.log_prefix}"
7676
standard_transition_days = "${var.log_standard_transition_days}"
@@ -79,12 +79,13 @@ module "logs" {
7979
}
8080

8181
module "distribution_label" {
82-
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.1"
83-
namespace = "${var.namespace}"
84-
stage = "${var.stage}"
85-
name = "${var.name}"
86-
delimiter = "${var.delimiter}"
87-
tags = "${var.tags}"
82+
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
83+
namespace = "${var.namespace}"
84+
stage = "${var.stage}"
85+
name = "${var.name}"
86+
delimiter = "${var.delimiter}"
87+
attributes = "${var.attributes}"
88+
tags = "${var.tags}"
8889
}
8990

9091
resource "null_resource" "default" {

variables.tf

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
1-
variable "name" {}
2-
variable "namespace" {}
3-
variable "stage" {}
1+
variable "namespace" {
2+
description = "Namespace (e.g. `cp` or `cloudposse`)"
3+
type = "string"
4+
}
45

5-
variable "tags" {
6-
type = "map"
7-
default = {}
6+
variable "stage" {
7+
description = "Stage (e.g. `prod`, `dev`, `staging`)"
8+
type = "string"
9+
}
10+
11+
variable "name" {
12+
description = "Name (e.g. `bastion` or `db`)"
13+
type = "string"
814
}
915

1016
variable "delimiter" {
11-
default = "-"
17+
type = "string"
18+
default = "-"
19+
description = "Delimiter to be used between `name`, `namespace`, `stage`, etc."
20+
}
21+
22+
variable "attributes" {
23+
type = "list"
24+
default = []
25+
description = "Additional attributes (e.g. `policy` or `role`)"
26+
}
27+
28+
variable "tags" {
29+
type = "map"
30+
default = {}
31+
description = "Additional tags (e.g. map('BusinessUnit`,`XYZ`)"
1232
}
1333

1434
variable "enabled" {

0 commit comments

Comments
 (0)