lib/terraforming/resource/iam_policy.rb in terraforming-0.7.0 vs lib/terraforming/resource/iam_policy.rb in terraforming-0.8.0
- old
+ new
@@ -24,10 +24,11 @@
version = iam_policy_version_of(policy)
attributes = {
"id" => policy.arn,
"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}"] = {
"type" => "aws_iam_policy",
"primary" => {
@@ -41,10 +42,14 @@
end
private
def iam_policies
- @client.list_policies(scope: "Local").policies
+ @client.list_policies(scope: "Local").collect {|r| r.policies}.flatten
+ end
+
+ def iam_policy_description(policy)
+ @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