This repository has been archived by the owner on Oct 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Network CIDR Calculations (#3)
* Support Network CIDR Calculations * Minor fixes
- Loading branch information
Showing
14 changed files
with
132 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
This directory contains modules used to create all the scaffolding. It's basically a code generator which creates directories, `Dockerfiles` and builds docker images. | ||
This directory contains modules used to create all the scaffolding. It's basically a **code generator** which creates directories, `Dockerfiles`, some boilerplate terraform code and then builds docker images. | ||
|
||
These terraform modules are not intended to be used (or useful) outside of this repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
locals { | ||
keys = "${keys(var.env)}" | ||
values = "${values(var.env)}" | ||
} | ||
|
||
data "null_data_source" "envs" { | ||
count = "${length(local.keys)}" | ||
|
||
inputs = { | ||
encoded = "${format(var.format, element(local.keys, count.index), jsonencode(element(local.values, count.index)))}" | ||
raw = "${format(var.format, element(local.keys, count.index), element(local.values, count.index))}" | ||
} | ||
} | ||
|
||
locals { | ||
export = { | ||
encoded = "${format(var.template, join("\n", data.null_data_source.envs.*.outputs.encoded))}" | ||
raw = "${format(var.template, join("\n", data.null_data_source.envs.*.outputs.raw))}" | ||
} | ||
} | ||
|
||
# Write an env file that we can use from shell scripts | ||
resource "local_file" "env_file" { | ||
content = "${local.export[var.type]}" | ||
filename = "${var.output_file}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
variable "env" { | ||
type = "map" | ||
} | ||
|
||
variable "output_file" {} | ||
|
||
variable "template" { | ||
default = "%s\n" | ||
} | ||
|
||
variable "format" { | ||
default = "export %s=%s" | ||
} | ||
|
||
variable "type" { | ||
default = "encoded" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.