1. Packages
  2. MinIO
  3. API Docs
  4. IamUserPolicyAttachment
MinIO v0.15.2 published on Friday, Feb 23, 2024 by Pulumi

minio.IamUserPolicyAttachment

Explore with Pulumi AI

minio logo
MinIO v0.15.2 published on Friday, Feb 23, 2024 by Pulumi

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Minio = Pulumi.Minio;
    
    return await Deployment.RunAsync(() => 
    {
        var testUser = new Minio.IamUser("testUser");
    
        var testPolicy = new Minio.IamPolicy("testPolicy", new()
        {
            Policy = @"{
      ""Version"":""2012-10-17"",
      ""Statement"": [
        {
          ""Sid"":""ListAllBucket"",
          ""Effect"": ""Allow"",
          ""Action"": [""s3:PutObject""],
          ""Principal"":""*"",
          ""Resource"": ""arn:aws:s3:::state-terraform-s3/*""
        }
      ]
    }
    ",
        });
    
        var developerIamUserPolicyAttachment = new Minio.IamUserPolicyAttachment("developerIamUserPolicyAttachment", new()
        {
            UserName = testUser.Id,
            PolicyName = testPolicy.Id,
        });
    
        var developerIndex_iamUserPolicyAttachmentIamUserPolicyAttachment = new Minio.IamUserPolicyAttachment("developerIndex/iamUserPolicyAttachmentIamUserPolicyAttachment", new()
        {
            UserName = "CN=My User,OU=Unit,DC=example,DC=com",
            PolicyName = testPolicy.Id,
        });
    
        return new Dictionary<string, object?>
        {
            ["minioName"] = developerIamUserPolicyAttachment.Id,
            ["minioUsers"] = developerIamUserPolicyAttachment.UserName,
            ["minioGroup"] = developerIamUserPolicyAttachment.PolicyName,
        };
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-minio/sdk/go/minio"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		testUser, err := minio.NewIamUser(ctx, "testUser", nil)
    		if err != nil {
    			return err
    		}
    		testPolicy, err := minio.NewIamPolicy(ctx, "testPolicy", &minio.IamPolicyArgs{
    			Policy: pulumi.String(`{
      "Version":"2012-10-17",
      "Statement": [
        {
          "Sid":"ListAllBucket",
          "Effect": "Allow",
          "Action": ["s3:PutObject"],
          "Principal":"*",
          "Resource": "arn:aws:s3:::state-terraform-s3/*"
        }
      ]
    }
    `),
    		})
    		if err != nil {
    			return err
    		}
    		developerIamUserPolicyAttachment, err := minio.NewIamUserPolicyAttachment(ctx, "developerIamUserPolicyAttachment", &minio.IamUserPolicyAttachmentArgs{
    			UserName:   testUser.ID(),
    			PolicyName: testPolicy.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		ctx.Export("minioName", developerIamUserPolicyAttachment.ID())
    		ctx.Export("minioUsers", developerIamUserPolicyAttachment.UserName)
    		ctx.Export("minioGroup", developerIamUserPolicyAttachment.PolicyName)
    		_, err = minio.NewIamUserPolicyAttachment(ctx, "developerIndex/iamUserPolicyAttachmentIamUserPolicyAttachment", &minio.IamUserPolicyAttachmentArgs{
    			UserName:   pulumi.String("CN=My User,OU=Unit,DC=example,DC=com"),
    			PolicyName: testPolicy.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.minio.IamUser;
    import com.pulumi.minio.IamPolicy;
    import com.pulumi.minio.IamPolicyArgs;
    import com.pulumi.minio.IamUserPolicyAttachment;
    import com.pulumi.minio.IamUserPolicyAttachmentArgs;
    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 testUser = new IamUser("testUser");
    
            var testPolicy = new IamPolicy("testPolicy", IamPolicyArgs.builder()        
                .policy("""
    {
      "Version":"2012-10-17",
      "Statement": [
        {
          "Sid":"ListAllBucket",
          "Effect": "Allow",
          "Action": ["s3:PutObject"],
          "Principal":"*",
          "Resource": "arn:aws:s3:::state-terraform-s3/*"
        }
      ]
    }
                """)
                .build());
    
            var developerIamUserPolicyAttachment = new IamUserPolicyAttachment("developerIamUserPolicyAttachment", IamUserPolicyAttachmentArgs.builder()        
                .userName(testUser.id())
                .policyName(testPolicy.id())
                .build());
    
            ctx.export("minioName", developerIamUserPolicyAttachment.id());
            ctx.export("minioUsers", developerIamUserPolicyAttachment.userName());
            ctx.export("minioGroup", developerIamUserPolicyAttachment.policyName());
            var developerIndex_iamUserPolicyAttachmentIamUserPolicyAttachment = new IamUserPolicyAttachment("developerIndex/iamUserPolicyAttachmentIamUserPolicyAttachment", IamUserPolicyAttachmentArgs.builder()        
                .userName("CN=My User,OU=Unit,DC=example,DC=com")
                .policyName(testPolicy.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_minio as minio
    
    test_user = minio.IamUser("testUser")
    test_policy = minio.IamPolicy("testPolicy", policy="""{
      "Version":"2012-10-17",
      "Statement": [
        {
          "Sid":"ListAllBucket",
          "Effect": "Allow",
          "Action": ["s3:PutObject"],
          "Principal":"*",
          "Resource": "arn:aws:s3:::state-terraform-s3/*"
        }
      ]
    }
    """)
    developer_iam_user_policy_attachment = minio.IamUserPolicyAttachment("developerIamUserPolicyAttachment",
        user_name=test_user.id,
        policy_name=test_policy.id)
    pulumi.export("minioName", developer_iam_user_policy_attachment.id)
    pulumi.export("minioUsers", developer_iam_user_policy_attachment.user_name)
    pulumi.export("minioGroup", developer_iam_user_policy_attachment.policy_name)
    developer_index_iam_user_policy_attachment_iam_user_policy_attachment = minio.IamUserPolicyAttachment("developerIndex/iamUserPolicyAttachmentIamUserPolicyAttachment",
        user_name="CN=My User,OU=Unit,DC=example,DC=com",
        policy_name=test_policy.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as minio from "@pulumi/minio";
    
    const testUser = new minio.IamUser("testUser", {});
    const testPolicy = new minio.IamPolicy("testPolicy", {policy: `{
      "Version":"2012-10-17",
      "Statement": [
        {
          "Sid":"ListAllBucket",
          "Effect": "Allow",
          "Action": ["s3:PutObject"],
          "Principal":"*",
          "Resource": "arn:aws:s3:::state-terraform-s3/*"
        }
      ]
    }
    `});
    const developerIamUserPolicyAttachment = new minio.IamUserPolicyAttachment("developerIamUserPolicyAttachment", {
        userName: testUser.id,
        policyName: testPolicy.id,
    });
    export const minioName = developerIamUserPolicyAttachment.id;
    export const minioUsers = developerIamUserPolicyAttachment.userName;
    export const minioGroup = developerIamUserPolicyAttachment.policyName;
    const developerIndex_iamUserPolicyAttachmentIamUserPolicyAttachment = new minio.IamUserPolicyAttachment("developerIndex/iamUserPolicyAttachmentIamUserPolicyAttachment", {
        userName: "CN=My User,OU=Unit,DC=example,DC=com",
        policyName: testPolicy.id,
    });
    
    resources:
      testUser:
        type: minio:IamUser
      testPolicy:
        type: minio:IamPolicy
        properties:
          policy: |
            {
              "Version":"2012-10-17",
              "Statement": [
                {
                  "Sid":"ListAllBucket",
                  "Effect": "Allow",
                  "Action": ["s3:PutObject"],
                  "Principal":"*",
                  "Resource": "arn:aws:s3:::state-terraform-s3/*"
                }
              ]
            }        
      developerIamUserPolicyAttachment:
        type: minio:IamUserPolicyAttachment
        properties:
          userName: ${testUser.id}
          policyName: ${testPolicy.id}
      developerIndex/iamUserPolicyAttachmentIamUserPolicyAttachment:
        type: minio:IamUserPolicyAttachment
        properties:
          userName: CN=My User,OU=Unit,DC=example,DC=com
          policyName: ${testPolicy.id}
    outputs:
      minioName: ${developerIamUserPolicyAttachment.id}
      minioUsers: ${developerIamUserPolicyAttachment.userName}
      minioGroup: ${developerIamUserPolicyAttachment.policyName} # Example using an LDAP User instead of a static MinIO group
    

    Create IamUserPolicyAttachment Resource

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

    Constructor syntax

    new IamUserPolicyAttachment(name: string, args: IamUserPolicyAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def IamUserPolicyAttachment(resource_name: str,
                                args: IamUserPolicyAttachmentArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def IamUserPolicyAttachment(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                policy_name: Optional[str] = None,
                                user_name: Optional[str] = None)
    func NewIamUserPolicyAttachment(ctx *Context, name string, args IamUserPolicyAttachmentArgs, opts ...ResourceOption) (*IamUserPolicyAttachment, error)
    public IamUserPolicyAttachment(string name, IamUserPolicyAttachmentArgs args, CustomResourceOptions? opts = null)
    public IamUserPolicyAttachment(String name, IamUserPolicyAttachmentArgs args)
    public IamUserPolicyAttachment(String name, IamUserPolicyAttachmentArgs args, CustomResourceOptions options)
    
    type: minio:IamUserPolicyAttachment
    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 IamUserPolicyAttachmentArgs
    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 IamUserPolicyAttachmentArgs
    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 IamUserPolicyAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IamUserPolicyAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args IamUserPolicyAttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var iamUserPolicyAttachmentResource = new Minio.IamUserPolicyAttachment("iamUserPolicyAttachmentResource", new()
    {
        PolicyName = "string",
        UserName = "string",
    });
    
    example, err := minio.NewIamUserPolicyAttachment(ctx, "iamUserPolicyAttachmentResource", &minio.IamUserPolicyAttachmentArgs{
    	PolicyName: pulumi.String("string"),
    	UserName:   pulumi.String("string"),
    })
    
    var iamUserPolicyAttachmentResource = new IamUserPolicyAttachment("iamUserPolicyAttachmentResource", IamUserPolicyAttachmentArgs.builder()        
        .policyName("string")
        .userName("string")
        .build());
    
    iam_user_policy_attachment_resource = minio.IamUserPolicyAttachment("iamUserPolicyAttachmentResource",
        policy_name="string",
        user_name="string")
    
    const iamUserPolicyAttachmentResource = new minio.IamUserPolicyAttachment("iamUserPolicyAttachmentResource", {
        policyName: "string",
        userName: "string",
    });
    
    type: minio:IamUserPolicyAttachment
    properties:
        policyName: string
        userName: string
    

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

    PolicyName string
    UserName string
    PolicyName string
    UserName string
    policyName String
    userName String
    policyName string
    userName string
    policyName String
    userName String

    Outputs

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

    Get an existing IamUserPolicyAttachment 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?: IamUserPolicyAttachmentState, opts?: CustomResourceOptions): IamUserPolicyAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            policy_name: Optional[str] = None,
            user_name: Optional[str] = None) -> IamUserPolicyAttachment
    func GetIamUserPolicyAttachment(ctx *Context, name string, id IDInput, state *IamUserPolicyAttachmentState, opts ...ResourceOption) (*IamUserPolicyAttachment, error)
    public static IamUserPolicyAttachment Get(string name, Input<string> id, IamUserPolicyAttachmentState? state, CustomResourceOptions? opts = null)
    public static IamUserPolicyAttachment get(String name, Output<String> id, IamUserPolicyAttachmentState 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:
    PolicyName string
    UserName string
    PolicyName string
    UserName string
    policyName String
    userName String
    policyName string
    userName string
    policyName String
    userName String

    Package Details

    Repository
    MinIO pulumi/pulumi-minio
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the minio Terraform Provider.
    minio logo
    MinIO v0.15.2 published on Friday, Feb 23, 2024 by Pulumi