Skip to content

Commit

Permalink
Dropping null_resource (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenvanderhoef authored and aknysh committed Aug 14, 2019
1 parent 2c5509e commit d6d24b8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,8 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply

### Contributors

| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] | [![Sergey Vasilyev][s2504s_avatar]][s2504s_homepage]<br/>[Sergey Vasilyev][s2504s_homepage] | [![Michael Pereira][MichaelPereira_avatar]][MichaelPereira_homepage]<br/>[Michael Pereira][MichaelPereira_homepage] | [![Jamie Nelson][Jamie-BitFlight_avatar]][Jamie-BitFlight_homepage]<br/>[Jamie Nelson][Jamie-BitFlight_homepage] | [![Vladimir][SweetOps_avatar]][SweetOps_homepage]<br/>[Vladimir][SweetOps_homepage] | [![Daren Desjardins][darend_avatar]][darend_homepage]<br/>[Daren Desjardins][darend_homepage] |
|---|---|---|---|---|---|---|---|
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] | [![Sergey Vasilyev][s2504s_avatar]][s2504s_homepage]<br/>[Sergey Vasilyev][s2504s_homepage] | [![Michael Pereira][MichaelPereira_avatar]][MichaelPereira_homepage]<br/>[Michael Pereira][MichaelPereira_homepage] | [![Jamie Nelson][Jamie-BitFlight_avatar]][Jamie-BitFlight_homepage]<br/>[Jamie Nelson][Jamie-BitFlight_homepage] | [![Vladimir][SweetOps_avatar]][SweetOps_homepage]<br/>[Vladimir][SweetOps_homepage] | [![Daren Desjardins][darend_avatar]][darend_homepage]<br/>[Daren Desjardins][darend_homepage] | [![Maarten van der Hoef][maartenvanderhoef_avatar]][maartenvanderhoef_homepage]<br/>[Maarten van der Hoef][maartenvanderhoef_homepage] |
|---|---|---|---|---|---|---|---|---|

[osterman_homepage]: https://github.com/osterman
[osterman_avatar]: https://github.com/osterman.png?size=150
Expand All @@ -683,6 +683,8 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
[SweetOps_avatar]: https://github.com/SweetOps.png?size=150
[darend_homepage]: https://github.com/darend
[darend_avatar]: https://github.com/darend.png?size=150
[maartenvanderhoef_homepage]: https://github.com/maartenvanderhoef
[maartenvanderhoef_avatar]: https://github.com/maartenvanderhoef.png?size=150



Expand Down
2 changes: 2 additions & 0 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -509,3 +509,5 @@ contributors:
github: "SweetOps"
- name: "Daren Desjardins"
github: "darend"
- name: "Maarten van der Hoef"
github: "maartenvanderhoef"
13 changes: 10 additions & 3 deletions examples/complete/label2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ module "label2" {
delimiter = "+"
regex_replace_chars = "/[^a-zA-Z0-9-+]/"

additional_tag_map = {
propagate_at_launch = "true"
additional_tag = "yes"
}


tags = {
"City" = "London"
"Environment" = "Public"
Expand All @@ -27,9 +33,10 @@ output "label2_tags" {
value = module.label2.tags
}

output "label2_tags_as_list_of_maps" {
value = module.label2.tags_as_list_of_maps
}

output "label2_context" {
value = module.label2.context
}



26 changes: 12 additions & 14 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,18 @@ locals {
# Merge attributes
attributes = compact(distinct(concat(var.attributes, var.context.attributes, local.defaults.attributes)))

tags = merge(var.context.tags, local.generated_tags, var.tags)
tags_as_list_of_maps = data.null_data_source.tags_as_list_of_maps.*.outputs
tags = merge(var.context.tags, local.generated_tags, var.tags)

tags_as_list_of_maps_unmerged_additional_tag_map = flatten([
for key in keys(local.tags) : {
key = key
value = local.tags[key]
}])

tags_as_list_of_maps = [
for tag_set in local.tags_as_list_of_maps_unmerged_additional_tag_map :
merge(tag_set, var.additional_tag_map)
]

tags_context = {
# For AWS we need `Name` to be disambiguated sine it has a special meaning
Expand Down Expand Up @@ -67,15 +77,3 @@ locals {
}

}

data "null_data_source" "tags_as_list_of_maps" {
count = local.enabled ? length(keys(local.tags)) : 0

inputs = merge(
{
"key" = keys(local.tags)[count.index]
"value" = values(local.tags)[count.index]
},
var.additional_tag_map
)
}

0 comments on commit d6d24b8

Please sign in to comment.