-
-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Support for List of Tag Maps #18
Changes from 7 commits
1c2ee27
39b26fb
c175941
0a635cc
1e3f27f
0cb08d4
3c6b730
9588798
d7ced5c
874b3b6
8890611
51e71ce
13ba4ae
14dcc69
d15fb3a
ca2d63e
5b25f97
2e6d0d2
37e2f08
e47f8ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,87 @@ resource "aws_instance" "eg_prod_bastion_xyz" { | |
vpc_security_group_ids = ["${aws_security_group.eg_prod_bastion_xyz.id}"] | ||
} | ||
``` | ||
### Advanced Example 2 | ||
|
||
Here is a more complex example with an autoscaling group that has a different tagging schema than other resources and requres its tags to be in this format, which this module can generate: | ||
```hcl | ||
tags = [ | ||
{ | ||
key = Name, | ||
propagate_at_launch = 1, | ||
value = namespace-stage-jamie | ||
}, | ||
{ | ||
key = Namespace, | ||
propagate_at_launch = 1, | ||
value = namespace | ||
}, | ||
{ | ||
key = Stage, | ||
propagate_at_launch = 1, | ||
value = stage | ||
} | ||
] | ||
``` | ||
|
||
Autoscaling group using proagating tagging below (full example within the examples folder) | ||
|
||
```hcl | ||
module "eg_prod_web_label" { | ||
source = "github.com/cloudposse/terraform-null-label.git?ref=master" | ||
namespace = "eg" | ||
stage = "prod" | ||
name = "WEB" | ||
attributes = ["abc"] | ||
delimiter = "-" | ||
tags = "${map("BusinessUnit", "Servers")}" | ||
} | ||
|
||
module "eg_prod_asg_label" { | ||
source = "github.com/cloudposse/terraform-null-label.git?ref=master" | ||
namespace = "eg" | ||
stage = "prod" | ||
name = "ASG" | ||
attributes = ["abc"] | ||
delimiter = "-" | ||
tags = "${map("BusinessUnit", "ScalingGroups")}" | ||
} | ||
|
||
resource "aws_autoscaling_group" "this" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change |
||
count = "${var.create_asg}" | ||
|
||
name_prefix = "${module.label.id}-" | ||
launch_configuration = "${var.create_lc ? element(aws_launch_configuration.this.*.name, 0) : var.launch_configuration}" | ||
vpc_zone_identifier = ["${var.vpc_zone_identifier}"] | ||
max_size = "${var.max_size}" | ||
min_size = "${var.min_size}" | ||
desired_capacity = "${var.desired_capacity}" | ||
|
||
load_balancers = ["${var.load_balancers}"] | ||
health_check_grace_period = "${var.health_check_grace_period}" | ||
health_check_type = "${var.health_check_type}" | ||
|
||
min_elb_capacity = "${var.min_elb_capacity}" | ||
wait_for_elb_capacity = "${var.wait_for_elb_capacity}" | ||
target_group_arns = ["${var.target_group_arns}"] | ||
default_cooldown = "${var.default_cooldown}" | ||
force_delete = "${var.force_delete}" | ||
termination_policies = "${var.termination_policies}" | ||
suspended_processes = "${var.suspended_processes}" | ||
placement_group = "${var.placement_group}" | ||
enabled_metrics = ["${var.enabled_metrics}"] | ||
metrics_granularity = "${var.metrics_granularity}" | ||
wait_for_capacity_timeout = "${var.wait_for_capacity_timeout}" | ||
protect_from_scale_in = "${var.protect_from_scale_in}" | ||
|
||
# Add tags to ASG that also apply to the servers that it creates | ||
tags = ["${module.eg_prod_web_label.tags_asg_propagate_true}"] | ||
# Or add tags that only apply to the ASG | ||
#tags = ["${module.eg_prod_asg_label.tags_asg_propagate_false}"] | ||
# Or mix them up | ||
#tags = ["${module.eg_prod_web_label.tags_asg_propagate_true}", "${module.eg_prod_asg_SOME_OTHER_label.tags_asg_propagate_false}"] | ||
} | ||
``` | ||
|
||
## Input | ||
|
||
|
@@ -148,6 +229,8 @@ resource "aws_instance" "eg_prod_bastion_xyz" { | |
| namespace | Normalized namespace | | ||
| stage | Normalized stage | | ||
| tags | Merge input tags with our tags. Note: `Name` has a special meaning in AWS and we need to disamgiuate it by using the computed `id` | | ||
| tags_asg_propagate_true | a list of maps that contain the ASG format tags with propagation set to true | | ||
| tags_asg_propagate_false | a list of maps that contain the ASG format tags with propagation set to false | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Jamie-BitFlight |
||
|
||
## Help | ||
|
||
|
@@ -213,8 +296,8 @@ or [hire us][hire] to help build your next cloud-platform. | |
|
||
### Contributors | ||
|
||
|[![Erik Osterman][erik_img]][erik_web]<br/>[Erik Osterman][erik_web] |[![Igor Rodionov][igor_img]][igor_web]<br/>[Igor Rodionov][igor_img] |[![Konstantin B][konstantin_img]][konstantin_web]<br/>[Konstantin B][konstantin_web] |[![Andriy Knysh][andriy_img]][andriy_web]<br/>[Andriy Knysh][andriy_web] |[![Sergey Vasilyev][sergey_img]][sergey_web]<br/>[Sergey Vasilyev][sergey_web] | | ||
|---|---|---|---|---| | ||
|[![Erik Osterman][erik_img]][erik_web]<br/>[Erik Osterman][erik_web] |[![Igor Rodionov][igor_img]][igor_web]<br/>[Igor Rodionov][igor_img] |[![Konstantin B][konstantin_img]][konstantin_web]<br/>[Konstantin B][konstantin_web] |[![Andriy Knysh][andriy_img]][andriy_web]<br/>[Andriy Knysh][andriy_web] |[![Sergey Vasilyev][sergey_img]][sergey_web]<br/>[Sergey Vasilyev][sergey_web] | [![Jamie Nelson][bitflight_img]][bitflight_web]<br/>[Jamie Nelson][bitflight_web] | | ||
|---|---|---|---|---|---| | ||
|
||
[andriy_img]: https://avatars0.githubusercontent.com/u/7356997?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144 | ||
[andriy_web]: https://github.com/aknysh/ | ||
|
@@ -236,3 +319,6 @@ or [hire us][hire] to help build your next cloud-platform. | |
|
||
[vladimir_img]: https://avatars1.githubusercontent.com/u/26582191?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144 | ||
[vladimir_web]: https://github.com/SweetOps/ | ||
|
||
[bitflight_img]: https://avatars0.githubusercontent.com/u/25075504?s=144&u=ac7e53bda3706cb9d51907808574b6d342703b3e&v=4 | ||
[bitflight_web]: https://github.com/Jamie-BitFlight |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo in
requres