1. Packages
  2. AWS
  3. API Docs
  4. ssoadmin
  5. PermissionSetInlinePolicy
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.ssoadmin.PermissionSetInlinePolicy

Explore with Pulumi AI

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = aws.ssoadmin.getInstances({});
const examplePermissionSet = new aws.ssoadmin.PermissionSet("example", {
    name: "Example",
    instanceArn: example.then(example => example.arns?.[0]),
});
const exampleGetPolicyDocument = aws.iam.getPolicyDocument({
    statements: [{
        sid: "1",
        actions: [
            "s3:ListAllMyBuckets",
            "s3:GetBucketLocation",
        ],
        resources: ["arn:aws:s3:::*"],
    }],
});
const examplePermissionSetInlinePolicy = new aws.ssoadmin.PermissionSetInlinePolicy("example", {
    inlinePolicy: exampleGetPolicyDocument.then(exampleGetPolicyDocument => exampleGetPolicyDocument.json),
    instanceArn: example.then(example => example.arns?.[0]),
    permissionSetArn: examplePermissionSet.arn,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.ssoadmin.get_instances()
example_permission_set = aws.ssoadmin.PermissionSet("example",
    name="Example",
    instance_arn=example.arns[0])
example_get_policy_document = aws.iam.get_policy_document(statements=[{
    "sid": "1",
    "actions": [
        "s3:ListAllMyBuckets",
        "s3:GetBucketLocation",
    ],
    "resources": ["arn:aws:s3:::*"],
}])
example_permission_set_inline_policy = aws.ssoadmin.PermissionSetInlinePolicy("example",
    inline_policy=example_get_policy_document.json,
    instance_arn=example.arns[0],
    permission_set_arn=example_permission_set.arn)
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssoadmin"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := ssoadmin.GetInstances(ctx, map[string]interface{}{}, nil)
		if err != nil {
			return err
		}
		examplePermissionSet, err := ssoadmin.NewPermissionSet(ctx, "example", &ssoadmin.PermissionSetArgs{
			Name:        pulumi.String("Example"),
			InstanceArn: pulumi.String(example.Arns[0]),
		})
		if err != nil {
			return err
		}
		exampleGetPolicyDocument, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
			Statements: []iam.GetPolicyDocumentStatement{
				{
					Sid: pulumi.StringRef("1"),
					Actions: []string{
						"s3:ListAllMyBuckets",
						"s3:GetBucketLocation",
					},
					Resources: []string{
						"arn:aws:s3:::*",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		_, err = ssoadmin.NewPermissionSetInlinePolicy(ctx, "example", &ssoadmin.PermissionSetInlinePolicyArgs{
			InlinePolicy:     pulumi.String(exampleGetPolicyDocument.Json),
			InstanceArn:      pulumi.String(example.Arns[0]),
			PermissionSetArn: examplePermissionSet.Arn,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.SsoAdmin.GetInstances.Invoke();

    var examplePermissionSet = new Aws.SsoAdmin.PermissionSet("example", new()
    {
        Name = "Example",
        InstanceArn = example.Apply(getInstancesResult => getInstancesResult.Arns[0]),
    });

    var exampleGetPolicyDocument = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Sid = "1",
                Actions = new[]
                {
                    "s3:ListAllMyBuckets",
                    "s3:GetBucketLocation",
                },
                Resources = new[]
                {
                    "arn:aws:s3:::*",
                },
            },
        },
    });

    var examplePermissionSetInlinePolicy = new Aws.SsoAdmin.PermissionSetInlinePolicy("example", new()
    {
        InlinePolicy = exampleGetPolicyDocument.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        InstanceArn = example.Apply(getInstancesResult => getInstancesResult.Arns[0]),
        PermissionSetArn = examplePermissionSet.Arn,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ssoadmin.SsoadminFunctions;
import com.pulumi.aws.ssoadmin.PermissionSet;
import com.pulumi.aws.ssoadmin.PermissionSetArgs;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.ssoadmin.PermissionSetInlinePolicy;
import com.pulumi.aws.ssoadmin.PermissionSetInlinePolicyArgs;
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) {
        final var example = SsoadminFunctions.getInstances(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);

        var examplePermissionSet = new PermissionSet("examplePermissionSet", PermissionSetArgs.builder()
            .name("Example")
            .instanceArn(example.arns()[0])
            .build());

        final var exampleGetPolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .sid("1")
                .actions(                
                    "s3:ListAllMyBuckets",
                    "s3:GetBucketLocation")
                .resources("arn:aws:s3:::*")
                .build())
            .build());

        var examplePermissionSetInlinePolicy = new PermissionSetInlinePolicy("examplePermissionSetInlinePolicy", PermissionSetInlinePolicyArgs.builder()
            .inlinePolicy(exampleGetPolicyDocument.json())
            .instanceArn(example.arns()[0])
            .permissionSetArn(examplePermissionSet.arn())
            .build());

    }
}
Copy
resources:
  examplePermissionSet:
    type: aws:ssoadmin:PermissionSet
    name: example
    properties:
      name: Example
      instanceArn: ${example.arns[0]}
  examplePermissionSetInlinePolicy:
    type: aws:ssoadmin:PermissionSetInlinePolicy
    name: example
    properties:
      inlinePolicy: ${exampleGetPolicyDocument.json}
      instanceArn: ${example.arns[0]}
      permissionSetArn: ${examplePermissionSet.arn}
variables:
  example:
    fn::invoke:
      function: aws:ssoadmin:getInstances
      arguments: {}
  exampleGetPolicyDocument:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - sid: '1'
            actions:
              - s3:ListAllMyBuckets
              - s3:GetBucketLocation
            resources:
              - arn:aws:s3:::*
Copy

Create PermissionSetInlinePolicy Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new PermissionSetInlinePolicy(name: string, args: PermissionSetInlinePolicyArgs, opts?: CustomResourceOptions);
@overload
def PermissionSetInlinePolicy(resource_name: str,
                              args: PermissionSetInlinePolicyArgs,
                              opts: Optional[ResourceOptions] = None)

@overload
def PermissionSetInlinePolicy(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              inline_policy: Optional[str] = None,
                              instance_arn: Optional[str] = None,
                              permission_set_arn: Optional[str] = None)
func NewPermissionSetInlinePolicy(ctx *Context, name string, args PermissionSetInlinePolicyArgs, opts ...ResourceOption) (*PermissionSetInlinePolicy, error)
public PermissionSetInlinePolicy(string name, PermissionSetInlinePolicyArgs args, CustomResourceOptions? opts = null)
public PermissionSetInlinePolicy(String name, PermissionSetInlinePolicyArgs args)
public PermissionSetInlinePolicy(String name, PermissionSetInlinePolicyArgs args, CustomResourceOptions options)
type: aws:ssoadmin:PermissionSetInlinePolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. PermissionSetInlinePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. PermissionSetInlinePolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. PermissionSetInlinePolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. PermissionSetInlinePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. PermissionSetInlinePolicyArgs
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 permissionSetInlinePolicyResource = new Aws.SsoAdmin.PermissionSetInlinePolicy("permissionSetInlinePolicyResource", new()
{
    InlinePolicy = "string",
    InstanceArn = "string",
    PermissionSetArn = "string",
});
Copy
example, err := ssoadmin.NewPermissionSetInlinePolicy(ctx, "permissionSetInlinePolicyResource", &ssoadmin.PermissionSetInlinePolicyArgs{
	InlinePolicy:     pulumi.String("string"),
	InstanceArn:      pulumi.String("string"),
	PermissionSetArn: pulumi.String("string"),
})
Copy
var permissionSetInlinePolicyResource = new PermissionSetInlinePolicy("permissionSetInlinePolicyResource", PermissionSetInlinePolicyArgs.builder()
    .inlinePolicy("string")
    .instanceArn("string")
    .permissionSetArn("string")
    .build());
Copy
permission_set_inline_policy_resource = aws.ssoadmin.PermissionSetInlinePolicy("permissionSetInlinePolicyResource",
    inline_policy="string",
    instance_arn="string",
    permission_set_arn="string")
Copy
const permissionSetInlinePolicyResource = new aws.ssoadmin.PermissionSetInlinePolicy("permissionSetInlinePolicyResource", {
    inlinePolicy: "string",
    instanceArn: "string",
    permissionSetArn: "string",
});
Copy
type: aws:ssoadmin:PermissionSetInlinePolicy
properties:
    inlinePolicy: string
    instanceArn: string
    permissionSetArn: string
Copy

PermissionSetInlinePolicy 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 PermissionSetInlinePolicy resource accepts the following input properties:

InlinePolicy This property is required. string
The IAM inline policy to attach to a Permission Set.
InstanceArn
This property is required.
Changes to this property will trigger replacement.
string
The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
PermissionSetArn
This property is required.
Changes to this property will trigger replacement.
string
The Amazon Resource Name (ARN) of the Permission Set.
InlinePolicy This property is required. string
The IAM inline policy to attach to a Permission Set.
InstanceArn
This property is required.
Changes to this property will trigger replacement.
string
The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
PermissionSetArn
This property is required.
Changes to this property will trigger replacement.
string
The Amazon Resource Name (ARN) of the Permission Set.
inlinePolicy This property is required. String
The IAM inline policy to attach to a Permission Set.
instanceArn
This property is required.
Changes to this property will trigger replacement.
String
The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
permissionSetArn
This property is required.
Changes to this property will trigger replacement.
String
The Amazon Resource Name (ARN) of the Permission Set.
inlinePolicy This property is required. string
The IAM inline policy to attach to a Permission Set.
instanceArn
This property is required.
Changes to this property will trigger replacement.
string
The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
permissionSetArn
This property is required.
Changes to this property will trigger replacement.
string
The Amazon Resource Name (ARN) of the Permission Set.
inline_policy This property is required. str
The IAM inline policy to attach to a Permission Set.
instance_arn
This property is required.
Changes to this property will trigger replacement.
str
The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
permission_set_arn
This property is required.
Changes to this property will trigger replacement.
str
The Amazon Resource Name (ARN) of the Permission Set.
inlinePolicy This property is required. String
The IAM inline policy to attach to a Permission Set.
instanceArn
This property is required.
Changes to this property will trigger replacement.
String
The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
permissionSetArn
This property is required.
Changes to this property will trigger replacement.
String
The Amazon Resource Name (ARN) of the Permission Set.

Outputs

All input properties are implicitly available as output properties. Additionally, the PermissionSetInlinePolicy 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 PermissionSetInlinePolicy Resource

Get an existing PermissionSetInlinePolicy 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?: PermissionSetInlinePolicyState, opts?: CustomResourceOptions): PermissionSetInlinePolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        inline_policy: Optional[str] = None,
        instance_arn: Optional[str] = None,
        permission_set_arn: Optional[str] = None) -> PermissionSetInlinePolicy
func GetPermissionSetInlinePolicy(ctx *Context, name string, id IDInput, state *PermissionSetInlinePolicyState, opts ...ResourceOption) (*PermissionSetInlinePolicy, error)
public static PermissionSetInlinePolicy Get(string name, Input<string> id, PermissionSetInlinePolicyState? state, CustomResourceOptions? opts = null)
public static PermissionSetInlinePolicy get(String name, Output<String> id, PermissionSetInlinePolicyState state, CustomResourceOptions options)
resources:  _:    type: aws:ssoadmin:PermissionSetInlinePolicy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.
The following state arguments are supported:
InlinePolicy string
The IAM inline policy to attach to a Permission Set.
InstanceArn Changes to this property will trigger replacement. string
The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
PermissionSetArn Changes to this property will trigger replacement. string
The Amazon Resource Name (ARN) of the Permission Set.
InlinePolicy string
The IAM inline policy to attach to a Permission Set.
InstanceArn Changes to this property will trigger replacement. string
The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
PermissionSetArn Changes to this property will trigger replacement. string
The Amazon Resource Name (ARN) of the Permission Set.
inlinePolicy String
The IAM inline policy to attach to a Permission Set.
instanceArn Changes to this property will trigger replacement. String
The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
permissionSetArn Changes to this property will trigger replacement. String
The Amazon Resource Name (ARN) of the Permission Set.
inlinePolicy string
The IAM inline policy to attach to a Permission Set.
instanceArn Changes to this property will trigger replacement. string
The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
permissionSetArn Changes to this property will trigger replacement. string
The Amazon Resource Name (ARN) of the Permission Set.
inline_policy str
The IAM inline policy to attach to a Permission Set.
instance_arn Changes to this property will trigger replacement. str
The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
permission_set_arn Changes to this property will trigger replacement. str
The Amazon Resource Name (ARN) of the Permission Set.
inlinePolicy String
The IAM inline policy to attach to a Permission Set.
instanceArn Changes to this property will trigger replacement. String
The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
permissionSetArn Changes to this property will trigger replacement. String
The Amazon Resource Name (ARN) of the Permission Set.

Import

Using pulumi import, import SSO Permission Set Inline Policies using the permission_set_arn and instance_arn separated by a comma (,). For example:

$ pulumi import aws:ssoadmin/permissionSetInlinePolicy:PermissionSetInlinePolicy example arn:aws:sso:::permissionSet/ssoins-2938j0x8920sbj72/ps-80383020jr9302rk,arn:aws:sso:::instance/ssoins-2938j0x8920sbj72
Copy

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 aws Terraform Provider.