Skip to content

Commit

Permalink
Adds environment variable for null-label / zone template usage (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gowiem authored Aug 19, 2020
1 parent e67dba0 commit 34b5ab3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Available targets:
| attributes | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | `string` | `"-"` | no |
| enabled | Set to false to prevent the module from creating or accessing any resources | `bool` | `true` | no |
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | `string` | `""` | no |
| name | The Name of the application or solution (e.g. `bastion` or `portal`) | `string` | n/a | yes |
| namespace | Namespace (e.g. `eg` or `cp`) | `string` | n/a | yes |
| parent\_zone\_id | ID of the hosted zone to contain this record (or specify `parent_zone_name`) | `string` | `""` | no |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
| attributes | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | `string` | `"-"` | no |
| enabled | Set to false to prevent the module from creating or accessing any resources | `bool` | `true` | no |
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | `string` | `""` | no |
| name | The Name of the application or solution (e.g. `bastion` or `portal`) | `string` | n/a | yes |
| namespace | Namespace (e.g. `eg` or `cp`) | `string` | n/a | yes |
| parent\_zone\_id | ID of the hosted zone to contain this record (or specify `parent_zone_name`) | `string` | `""` | no |
Expand Down
18 changes: 10 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
module "label" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.17.0"
namespace = var.namespace
stage = var.stage
name = var.name
delimiter = var.delimiter
attributes = var.attributes
tags = var.tags
enabled = var.enabled
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.17.0"
namespace = var.namespace
stage = var.stage
environment = var.environment
name = var.name
delimiter = var.delimiter
attributes = var.attributes
tags = var.tags
enabled = var.enabled
}

locals {
Expand All @@ -28,6 +29,7 @@ data "template_file" "zone_name" {

vars = {
namespace = var.namespace
environment = var.environment
name = var.name
stage = var.stage
id = module.label.id
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ variable "namespace" {
description = "Namespace (e.g. `eg` or `cp`)"
}

variable "environment" {
default = ""
type = string
description = "Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT'"
}

variable "stage" {
type = string
description = "Stage (e.g. `prod`, `dev`, `staging`)"
Expand Down

0 comments on commit 34b5ab3

Please sign in to comment.