published on Wednesday, Mar 11, 2026 by Pulumi
published on Wednesday, Mar 11, 2026 by Pulumi
Resource for maintaining exclusive management of managed IAM policies assigned to an AWS IAM (Identity & Access Management) group.
!> This resource takes exclusive ownership over managed IAM policies attached to a group. This includes removal of managed IAM policies which are not explicitly configured. To prevent persistent drift, ensure any aws.iam.GroupPolicyAttachment resources managed alongside this resource are included in the policy_arns argument.
Destruction of this resource means Terraform will no longer manage reconciliation of the configured policy attachments. It will not detach the configured policies from the group.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.iam.GroupPolicyAttachmentsExclusive("example", {
groupName: exampleAwsIamGroup.name,
policyArns: [exampleAwsIamPolicy.arn],
});
import pulumi
import pulumi_aws as aws
example = aws.iam.GroupPolicyAttachmentsExclusive("example",
group_name=example_aws_iam_group["name"],
policy_arns=[example_aws_iam_policy["arn"]])
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := iam.NewGroupPolicyAttachmentsExclusive(ctx, "example", &iam.GroupPolicyAttachmentsExclusiveArgs{
GroupName: pulumi.Any(exampleAwsIamGroup.Name),
PolicyArns: pulumi.StringArray{
exampleAwsIamPolicy.Arn,
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Iam.GroupPolicyAttachmentsExclusive("example", new()
{
GroupName = exampleAwsIamGroup.Name,
PolicyArns = new[]
{
exampleAwsIamPolicy.Arn,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.GroupPolicyAttachmentsExclusive;
import com.pulumi.aws.iam.GroupPolicyAttachmentsExclusiveArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new GroupPolicyAttachmentsExclusive("example", GroupPolicyAttachmentsExclusiveArgs.builder()
.groupName(exampleAwsIamGroup.name())
.policyArns(exampleAwsIamPolicy.arn())
.build());
}
}
resources:
example:
type: aws:iam:GroupPolicyAttachmentsExclusive
properties:
groupName: ${exampleAwsIamGroup.name}
policyArns:
- ${exampleAwsIamPolicy.arn}
Disallow Managed IAM Policies
To automatically remove any configured managed IAM policies, set the policy_arns argument to an empty list.
This will not prevent managed IAM policies from being assigned to a group via Terraform (or any other interface). This resource enables bringing managed IAM policy assignments into a configured state, however, this reconciliation happens only when
applyis proactively run.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.iam.GroupPolicyAttachmentsExclusive("example", {
groupName: exampleAwsIamGroup.name,
policyArns: [],
});
import pulumi
import pulumi_aws as aws
example = aws.iam.GroupPolicyAttachmentsExclusive("example",
group_name=example_aws_iam_group["name"],
policy_arns=[])
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := iam.NewGroupPolicyAttachmentsExclusive(ctx, "example", &iam.GroupPolicyAttachmentsExclusiveArgs{
GroupName: pulumi.Any(exampleAwsIamGroup.Name),
PolicyArns: pulumi.StringArray{},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Iam.GroupPolicyAttachmentsExclusive("example", new()
{
GroupName = exampleAwsIamGroup.Name,
PolicyArns = new[] {},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.GroupPolicyAttachmentsExclusive;
import com.pulumi.aws.iam.GroupPolicyAttachmentsExclusiveArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new GroupPolicyAttachmentsExclusive("example", GroupPolicyAttachmentsExclusiveArgs.builder()
.groupName(exampleAwsIamGroup.name())
.policyArns()
.build());
}
}
resources:
example:
type: aws:iam:GroupPolicyAttachmentsExclusive
properties:
groupName: ${exampleAwsIamGroup.name}
policyArns: []
Create GroupPolicyAttachmentsExclusive Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new GroupPolicyAttachmentsExclusive(name: string, args: GroupPolicyAttachmentsExclusiveArgs, opts?: CustomResourceOptions);@overload
def GroupPolicyAttachmentsExclusive(resource_name: str,
args: GroupPolicyAttachmentsExclusiveArgs,
opts: Optional[ResourceOptions] = None)
@overload
def GroupPolicyAttachmentsExclusive(resource_name: str,
opts: Optional[ResourceOptions] = None,
group_name: Optional[str] = None,
policy_arns: Optional[Sequence[str]] = None)func NewGroupPolicyAttachmentsExclusive(ctx *Context, name string, args GroupPolicyAttachmentsExclusiveArgs, opts ...ResourceOption) (*GroupPolicyAttachmentsExclusive, error)public GroupPolicyAttachmentsExclusive(string name, GroupPolicyAttachmentsExclusiveArgs args, CustomResourceOptions? opts = null)
public GroupPolicyAttachmentsExclusive(String name, GroupPolicyAttachmentsExclusiveArgs args)
public GroupPolicyAttachmentsExclusive(String name, GroupPolicyAttachmentsExclusiveArgs args, CustomResourceOptions options)
type: aws:iam:GroupPolicyAttachmentsExclusive
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args GroupPolicyAttachmentsExclusiveArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args GroupPolicyAttachmentsExclusiveArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args GroupPolicyAttachmentsExclusiveArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GroupPolicyAttachmentsExclusiveArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args GroupPolicyAttachmentsExclusiveArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var groupPolicyAttachmentsExclusiveResource = new Aws.Iam.GroupPolicyAttachmentsExclusive("groupPolicyAttachmentsExclusiveResource", new()
{
GroupName = "string",
PolicyArns = new[]
{
"string",
},
});
example, err := iam.NewGroupPolicyAttachmentsExclusive(ctx, "groupPolicyAttachmentsExclusiveResource", &iam.GroupPolicyAttachmentsExclusiveArgs{
GroupName: pulumi.String("string"),
PolicyArns: pulumi.StringArray{
pulumi.String("string"),
},
})
var groupPolicyAttachmentsExclusiveResource = new GroupPolicyAttachmentsExclusive("groupPolicyAttachmentsExclusiveResource", GroupPolicyAttachmentsExclusiveArgs.builder()
.groupName("string")
.policyArns("string")
.build());
group_policy_attachments_exclusive_resource = aws.iam.GroupPolicyAttachmentsExclusive("groupPolicyAttachmentsExclusiveResource",
group_name="string",
policy_arns=["string"])
const groupPolicyAttachmentsExclusiveResource = new aws.iam.GroupPolicyAttachmentsExclusive("groupPolicyAttachmentsExclusiveResource", {
groupName: "string",
policyArns: ["string"],
});
type: aws:iam:GroupPolicyAttachmentsExclusive
properties:
groupName: string
policyArns:
- string
GroupPolicyAttachmentsExclusive Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The GroupPolicyAttachmentsExclusive resource accepts the following input properties:
- Group
Name string - IAM group name.
- Policy
Arns List<string> - A list of managed IAM policy ARNs to be attached to the group. Policies attached to this group but not configured in this argument will be removed.
- Group
Name string - IAM group name.
- Policy
Arns []string - A list of managed IAM policy ARNs to be attached to the group. Policies attached to this group but not configured in this argument will be removed.
- group
Name String - IAM group name.
- policy
Arns List<String> - A list of managed IAM policy ARNs to be attached to the group. Policies attached to this group but not configured in this argument will be removed.
- group
Name string - IAM group name.
- policy
Arns string[] - A list of managed IAM policy ARNs to be attached to the group. Policies attached to this group but not configured in this argument will be removed.
- group_
name str - IAM group name.
- policy_
arns Sequence[str] - A list of managed IAM policy ARNs to be attached to the group. Policies attached to this group but not configured in this argument will be removed.
- group
Name String - IAM group name.
- policy
Arns List<String> - A list of managed IAM policy ARNs to be attached to the group. Policies attached to this group but not configured in this argument will be removed.
Outputs
All input properties are implicitly available as output properties. Additionally, the GroupPolicyAttachmentsExclusive resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing GroupPolicyAttachmentsExclusive Resource
Get an existing GroupPolicyAttachmentsExclusive resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: GroupPolicyAttachmentsExclusiveState, opts?: CustomResourceOptions): GroupPolicyAttachmentsExclusive@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
group_name: Optional[str] = None,
policy_arns: Optional[Sequence[str]] = None) -> GroupPolicyAttachmentsExclusivefunc GetGroupPolicyAttachmentsExclusive(ctx *Context, name string, id IDInput, state *GroupPolicyAttachmentsExclusiveState, opts ...ResourceOption) (*GroupPolicyAttachmentsExclusive, error)public static GroupPolicyAttachmentsExclusive Get(string name, Input<string> id, GroupPolicyAttachmentsExclusiveState? state, CustomResourceOptions? opts = null)public static GroupPolicyAttachmentsExclusive get(String name, Output<String> id, GroupPolicyAttachmentsExclusiveState state, CustomResourceOptions options)resources: _: type: aws:iam:GroupPolicyAttachmentsExclusive get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Group
Name string - IAM group name.
- Policy
Arns List<string> - A list of managed IAM policy ARNs to be attached to the group. Policies attached to this group but not configured in this argument will be removed.
- Group
Name string - IAM group name.
- Policy
Arns []string - A list of managed IAM policy ARNs to be attached to the group. Policies attached to this group but not configured in this argument will be removed.
- group
Name String - IAM group name.
- policy
Arns List<String> - A list of managed IAM policy ARNs to be attached to the group. Policies attached to this group but not configured in this argument will be removed.
- group
Name string - IAM group name.
- policy
Arns string[] - A list of managed IAM policy ARNs to be attached to the group. Policies attached to this group but not configured in this argument will be removed.
- group_
name str - IAM group name.
- policy_
arns Sequence[str] - A list of managed IAM policy ARNs to be attached to the group. Policies attached to this group but not configured in this argument will be removed.
- group
Name String - IAM group name.
- policy
Arns List<String> - A list of managed IAM policy ARNs to be attached to the group. Policies attached to this group but not configured in this argument will be removed.
Import
Using pulumi import, import exclusive management of managed IAM policy assignments using the group_name. For example:
$ pulumi import aws:iam/groupPolicyAttachmentsExclusive:GroupPolicyAttachmentsExclusive example MyGroup
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
published on Wednesday, Mar 11, 2026 by Pulumi
