Commit 11524f08 authored by Daisuke Fujita's avatar Daisuke Fujita

Export tag with hashcode

parent 83353490
......@@ -40,6 +40,15 @@ module Terraforming
"vpc_zone_identifier.#" => vpc_zone_specified ? vpc_zone_identifier_of(group).length.to_s : "0",
}
group.tags.each do |tag|
hashcode = tag_hashcode_of(tag)
attributes.merge!({
"tag.#{hashcode}.key" => tag.key,
"tag.#{hashcode}.propagate_at_launch" => tag.propagate_at_launch.to_s,
"tag.#{hashcode}.value" => tag.value,
})
end
resources["aws_autoscaling_group.#{module_name_of(group)}"] = {
"type" => "aws_autoscaling_group",
"primary" => {
......@@ -65,6 +74,10 @@ module Terraforming
normalize_module_name(group.auto_scaling_group_name)
end
def tag_hashcode_of(tag)
Zlib.crc32("#{tag.key}-#{tag.value}-#{tag.propagate_at_launch}-")
end
def vpc_zone_identifier_of(group)
group.vpc_zone_identifier.split(",")
end
......
......@@ -47,7 +47,7 @@ module Terraforming
{
resource_id: "hoge",
resource_type: "auto-scaling-group",
key: "foo",
key: "foo1",
value: "bar",
propagate_at_launch: true,
}
......@@ -111,7 +111,7 @@ resource "aws_autoscaling_group" "hoge" {
name = "hoge"
tag {
key = "foo"
key = "foo1"
value = "bar"
propagate_at_launch = true
}
......@@ -155,6 +155,9 @@ resource "aws_autoscaling_group" "fuga" {
"min_size" => "1",
"name" => "hoge",
"tag.#" => "1",
"tag.3921462319.key" => "foo1",
"tag.3921462319.propagate_at_launch" => "true",
"tag.3921462319.value" => "bar",
"termination_policies.#" => "0",
"vpc_zone_identifier.#" => "0",
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment