Skip to content

Commit

Permalink
Add enabled variable (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
darend authored and osterman committed Oct 30, 2017
1 parent c64ea76 commit c528f1c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,14 @@ resource "aws_instance" "eg_prod_bastion_xyz" {

## Variables

| Name | Default | Description | Required |
|:-----------------------------|:--------------:|:--------------------------------------------------------|:--------:|
| namespace | `` | Namespace (e.g. `cp` or `cloudposse`) | Yes |
| stage | `` | Stage (e.g. `prod`, `dev`, `staging`) | Yes |
| name | `` | Name (e.g. `bastion` or `db`) | Yes |
| attributes | [] | Additional attributes (e.g. `policy` or `role`) | No |
| tags | {} | Additional tags (e.g. `map("BusinessUnit","XYZ")` | No |
| Name | Default | Description | Required |
|:-----------------------------|:--------------:|:------------------------------------------------------------|:--------:|
| namespace | `` | Namespace (e.g. `cp` or `cloudposse`) | Yes |
| stage | `` | Stage (e.g. `prod`, `dev`, `staging`) | Yes |
| name | `` | Name (e.g. `bastion` or `db`) | Yes |
| attributes | [] | Additional attributes (e.g. `policy` or `role`) | No |
| tags | {} | Additional tags (e.g. `map("BusinessUnit","XYZ")` | No |
| enabled | true | Set to false to prevent the module from creating anything | No |

**WARNING** Any tags passed as an input to this module will *override* the tags generated by this module.

Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
resource "null_resource" "default" {
count = "${var.enabled == "true" ? 1 : 0}"

triggers = {
id = "${lower(join(var.delimiter, compact(concat(list(var.namespace, var.stage, var.name), var.attributes))))}"
name = "${lower(format("%v", var.name))}"
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ variable "namespace" {}
variable "stage" {}
variable "name" {}

variable "enabled" {
description = "Set to false to prevent the module from creating any resources"
default = true
}

variable "delimiter" {
type = "string"
default = "-"
Expand Down

0 comments on commit c528f1c

Please sign in to comment.