1. Packages
  2. AWS
  3. API Docs
  4. ssoadmin
  5. PermissionSetInlinePolicy
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

aws.ssoadmin.PermissionSetInlinePolicy

Explore with Pulumi AI

aws logo
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

    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,
    });
    
    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)
    
    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, nil, 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
    	})
    }
    
    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,
        });
    
    });
    
    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();
    
            var examplePermissionSet = new PermissionSet("examplePermissionSet", PermissionSetArgs.builder()
                .name("Example")
                .instanceArn(example.applyValue(getInstancesResult -> getInstancesResult.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.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
                .instanceArn(example.applyValue(getInstancesResult -> getInstancesResult.arns()[0]))
                .permissionSetArn(examplePermissionSet.arn())
                .build());
    
        }
    }
    
    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:::*
    

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

    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

    The PermissionSetInlinePolicy resource accepts the following input properties:

    InlinePolicy string
    The IAM inline policy to attach to a Permission Set.
    InstanceArn string
    The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    PermissionSetArn string
    The Amazon Resource Name (ARN) of the Permission Set.
    InlinePolicy string
    The IAM inline policy to attach to a Permission Set.
    InstanceArn string
    The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    PermissionSetArn string
    The Amazon Resource Name (ARN) of the Permission Set.
    inlinePolicy String
    The IAM inline policy to attach to a Permission Set.
    instanceArn String
    The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    permissionSetArn String
    The Amazon Resource Name (ARN) of the Permission Set.
    inlinePolicy string
    The IAM inline policy to attach to a Permission Set.
    instanceArn string
    The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    permissionSetArn 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 str
    The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    permission_set_arn str
    The Amazon Resource Name (ARN) of the Permission Set.
    inlinePolicy String
    The IAM inline policy to attach to a Permission Set.
    instanceArn String
    The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    permissionSetArn 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)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    InlinePolicy string
    The IAM inline policy to attach to a Permission Set.
    InstanceArn string
    The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    PermissionSetArn string
    The Amazon Resource Name (ARN) of the Permission Set.
    InlinePolicy string
    The IAM inline policy to attach to a Permission Set.
    InstanceArn string
    The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    PermissionSetArn string
    The Amazon Resource Name (ARN) of the Permission Set.
    inlinePolicy String
    The IAM inline policy to attach to a Permission Set.
    instanceArn String
    The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    permissionSetArn String
    The Amazon Resource Name (ARN) of the Permission Set.
    inlinePolicy string
    The IAM inline policy to attach to a Permission Set.
    instanceArn string
    The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    permissionSetArn 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 str
    The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    permission_set_arn str
    The Amazon Resource Name (ARN) of the Permission Set.
    inlinePolicy String
    The IAM inline policy to attach to a Permission Set.
    instanceArn String
    The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    permissionSetArn 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
    

    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.
    aws logo
    AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi