user_policy_attachment#

State module for managing IAM User Policy Attachments.

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

Attaches the specified managed policy to the specified user.

Use this operation to attach a managed policy to a user.

Parameters:
  • name (str) – An Idem name of the state.

  • user_name (str) – The name (friendly name, not ARN) of the IAM user to detach the policy from. 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) – 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>

Request Syntax:
[iam-attach-user-policy]:
  aws.iam.user_policy_attachment.present:
    - name: "string"
    - user_name: 'string'
    - policy_arn: 'string'
    - resource_id: "string"
Returns:

Dict[str, Any]

Examples

idem-test-attach-policy:
  aws.iam.user_policy_attachment.present:
    - name: test-policy-attachment
    - user_name: serverless
    - policy_arn: arn:aws:iam::aws:policy/AdministratorAccess
async idem_aws.states.aws.iam.user_policy_attachment.absent(hub, ctx, name: str, *, resource_id: str = None, user_name: str = None, policy_arn: str = None) Dict[str, Any][source]#

Removes the specified managed policy from the specified user.

A user can also have inline policies embedded with it. To delete an inline policy, use DeleteUserPolicy

Parameters:
  • name (str) – An Idem name of the state.

  • 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.

  • user_name (str, Optional) – The name (friendly name, not ARN) of the IAM user to detach the policy from. 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.

Request Syntax:
[iam-user-policy-name]:
  aws.iam.user_policy_attachment.absent:
    - name: 'string'
    - user_name: 'string'
    - policy_arn: 'string'
    - resource_id: 'string'
Returns:

Dict[str, Any]

Examples

idem-test-attach-policy:
  aws.iam.user_policy_attachment.absent:
    - name: test-policy-attachment
    - user_name: serverless
    - policy_arn: arn:aws:iam::aws:policy/AdministratorAccess
async idem_aws.states.aws.iam.user_policy_attachment.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#

Describe the resource in a way that can be recreated/managed with the corresponding “present” function

Lists all managed policies that are attached to the specified IAM user. Lists all managed policies that are attached to the specified IAM user.

Returns:

Dict[str, Any]

Examples

$ idem describe aws_auto.iam.user_policy_attachment