Skip to content

Commit 6916e50

Browse files
author
Steven Nemetz
committed
first commit
0 parents  commit 6916e50

File tree

6 files changed

+64
-0
lines changed

6 files changed

+64
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.tfstate
2+
*.tfstate.backup
3+
.terraform

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Terraform module to provide consistent naming
2+
===

main.tf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# Terraform module to provide consistent naming
3+
#
4+
5+
local {
6+
name = "${var.namespaced ? format("%s-%s", var.environment, var.name) : format("%s", var.name)}"
7+
tags = "${ merge(
8+
var.tags,
9+
map("Name", var.name),
10+
map("Environment", var.environment),
11+
map("Terraform", "true") )}"
12+
}
13+
/*
14+
resource "null_resource" "default" {
15+
count = "${var.enabled == "true" ? 1 : 0}"
16+
17+
triggers = {
18+
id = "${lower(join(var.delimiter, compact(concat(list(var.namespace, var.stage, var.name), var.attributes))))}"
19+
name = "${lower(format("%v", var.name))}"
20+
namespace = "${lower(format("%v", var.namespace))}"
21+
stage = "${lower(format("%v", var.stage))}"
22+
attributes = "${lower(format("%v", join(var.delimiter, compact(var.attributes))))}"
23+
}
24+
25+
lifecycle {
26+
create_before_destroy = true
27+
}
28+
}
29+
*/

outputs.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
output "name" {
4+
description = "Name"
5+
value = "${var.name}"
6+
}
7+
output "tags" {
8+
description = "Tags"
9+
value = "${var.tags}"
10+
}

test/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Test cases
2+
===

variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Standard Variables
2+
3+
variable "name" {
4+
description = "Name for the EFS Filesystem"
5+
}
6+
variable "environment" {
7+
description = "Environment (ex: dev, qa, stage, prod)"
8+
}
9+
variable "namespaced" {
10+
description = "Namespace all resources (prefixed with the environment)?"
11+
default = true
12+
}
13+
variable "tags" {
14+
description = "A map of tags to add to all resources"
15+
default = {}
16+
}
17+
18+
// Module specific Variables

0 commit comments

Comments
 (0)