iam-policy

cloudposse/iam-policy/aws

Terraform Module HCL AWS

Create an IAM policy from Terraform input

Install
module "iam-policy" {
source = "cloudposse/iam-policy/aws"
version = "2.0.2"
}
plain text: /constructs/tfmod-cloudposse-iam-policy-aws/install.txt
⭐ Source on GitHub 📦 Registry page
README

This terraform-aws-iam-policy module is a wrapper around the Terraform aws_iam_policy_document data source, enhancing it to provide multiple ways to create an AWS IAM Policy document (as a JSON string). It is primarily intended to simplify creating a policy in Terraform from external inputs. In particular, if you want to specify a policy in a tfvars file as a Terraform object, or in YAML as part of an Atmos stack (which is them turned into a Terraform object input), this module provides an object type declaration to use for the input and then it can make the translation to JSON for you. If you can supply the policy as JSON to begin with, or conveniently use the aws_iam_policy_document Terraform data source directly, then this module is not helpful in your case. > [!NOTE] > AWS's IAM policy

Inputs (27)
NameTypeDescriptionDefault
tagsmap(string)Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`). Neither the tag keys nor the t{}
label_orderlist(string)The order in which the labels (ID elements) appear in the `id`. Defaults to ["nanull
regex_replace_charsstringTerraform regular expression (regex) string. Characters matching the regex will null
id_length_limitnumberLimit `id` to this many characters (minimum 6). Set to `0` for unlimited length.null
label_key_casestringControls the letter case of the `tags` keys (label names) for tags generated by null
descriptor_formatsanyDescribe additional descriptors to be output in the `descriptors` output map. Ma{}
contextanySingle object for setting entire context at once. See description of individual { "additional_tag_map": {}, "attribu
namespacestringID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp'null
tenantstringID element _(Rarely used, not included by default)_. A customer identifier, indinull
namestringID element. Usually the component or solution name, e.g. 'app' or 'jenkins'. Thinull
labels_as_tagsset(string)Set of labels (ID elements) to include as tags in the `tags` output. Default is [ "default" ]
additional_tag_mapmap(string)Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not add{}
label_value_casestringControls the letter case of ID elements (labels) as included in `id`, set as tagnull
iam_policy_statementsanyDeprecated: Use `iam_policy` instead. List or Map of IAM policy statements to us[]
delimiterstringDelimiter to be used between ID elements. Defaults to `-` (hyphen). Set to `""` null
attributeslist(string)ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`, []
iam_policy_idstringDeprecated: Use `iam_policy` instead: ID for the policy document when using `iamnull
iam_policylist(object({ policy_id = IAM policy as list of Terraform objects, compatible with Terraform `aws_iam_poli[]
iam_source_policy_documentslist(string)List of IAM policy documents (as JSON strings) that are merged together into thenull
environmentstringID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'stnull
Outputs (2)
policy_arn — ARN of created IAM policy
json — JSON body of the IAM policy document
Resources (3)
aws_iam_policyaws_iam_role_policyaws_iam_role_policy_attachment
Details
FrameworkTerraform Module
LanguageHCL
Version2.0.2
Cloud AWS
★ Stars21
Forks15
Total downloads4.7M
Inputs27
Outputs2
Resources3
Examples1
LicenseApache-2.0
Namespacecloudposse
Updated