user_policy_attachment#

async idem_aws.exec.aws.iam.user_policy_attachment.get(hub, ctx, *, name: str = None, user_name: str = None, policy_arn: str = None, resource_id: str = None) Dict[str, Any][source]#

Check if a managed policy is attached to a user

Parameters:
  • name (str, Optional) – An Idem name of the state for logging.

  • user_name (str, Optional) – The name (friendly name, not ARN) of the IAM user to attach the policy to. This parameter allows (through its regex pattern ) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

  • policy_arn (str, Optional) – The Amazon Resource Name (ARN) of the IAM policy you want to attach.

  • resource_id (str, Optional) – An identifier refers to an existing resource. The format is <user_name>/<policy_arn> Either resource_id or both user_name and policy_arn should be specified for absent.

Returns:

Returns IAM user policy attachemnt in present format

Return type:

Dict[str, Any]

Examples

Calling this exec module function from the cli with resource_id

idem exec aws.iam.user_policy_attachment.get name="name" resource_id="resource_id"

Using in a state:

my_unmanaged_resource:
  exec.run:
    - path: aws.iam.user_policy_attachment.get
    - kwargs:
        name: my_resource
        resource_id: resource_id