lib/terraforming/resource/iam_policy.rb in terraforming-0.12.0 vs lib/terraforming/resource/iam_policy.rb in terraforming-0.13.0
- old
+ new
@@ -27,11 +27,11 @@
"name" => policy.policy_name,
"path" => policy.path,
"description" => iam_policy_description(policy),
"policy" => prettify_policy(version.document, breakline: true, unescape: true),
}
- resources["aws_iam_policy.#{policy.policy_name}"] = {
+ resources["aws_iam_policy.#{module_name_of(policy)}"] = {
"type" => "aws_iam_policy",
"primary" => {
"id" => policy.arn,
"attributes" => attributes
}
@@ -51,9 +51,13 @@
@client.get_policy(policy_arn: policy.arn).policy.description
end
def iam_policy_version_of(policy)
@client.get_policy_version(policy_arn: policy.arn, version_id: policy.default_version_id).policy_version
+ end
+
+ def module_name_of(policy)
+ normalize_module_name(policy.policy_name)
end
end
end
end