-
-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "tenant", "labels_as_tags", and "descriptors" (#132)
- Loading branch information
Showing
21 changed files
with
1,221 additions
and
333 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,28 @@ | ||
# It would be nice to have a fixed array of arguments passed into | ||
# `format()` so all you need to provide is a format string, but | ||
# unfortunately, that does not work easily | ||
# due to https://github.com/hashicorp/terraform/issues/28558 | ||
# which requires that the format string consume the last argument passed in. | ||
# We could hack around it by adding then removing a trailing arg, like | ||
# | ||
# trimsuffix(format("${var.format_string}%[${length(local.labels)+1}]v", concat(local.labels, ["x"])...), "x") | ||
# | ||
# but that is kind of a hack, and overlooks the fact that local.labels | ||
# drops empty label elements, so the index of an element is not guaranteed. | ||
# | ||
# | ||
# So we require the user to specify the arguments as well as the format string. | ||
# | ||
|
||
# There is a lot of room for enhancement, but since this is a new feature | ||
# with only 2 use cases, we are going to keep it simple for now. | ||
|
||
locals { | ||
descriptor_labels = { for k, v in var.descriptor_formats : k => [ | ||
for label in v.labels : local.id_context[label] | ||
] } | ||
descriptors = { for k, v in var.descriptor_formats : k => ( | ||
format(v.format, local.descriptor_labels[k]...) | ||
) | ||
} | ||
} |
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,4 +1,5 @@ | ||
.terraform | ||
.terraform.lock.hcl | ||
**/.terraform/* | ||
*.tfstate | ||
*.tfstate.* | ||
|
Oops, something went wrong.