Skip to content
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

Merged
merged 20 commits into from
May 16, 2018
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 88 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in requres

```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" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this to default as it's used in all CloudPosse modules

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

Expand Down Expand Up @@ -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 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jamie-BitFlight
please remove everything related to other technologies and services from this module.
it's the lowest-level generic module which all other modules use.
it should not mention anything like EC2 or ASG in the inputs.
thanks


## Help

Expand Down Expand Up @@ -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/
Expand All @@ -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
Loading