1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. ram
  5. GroupPolicyAttachment
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.ram.GroupPolicyAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    Provides a RAM Group Policy attachment resource.

    NOTE: Available since v1.0.0+.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    // Create a RAM Group Policy attachment.
    const group = new alicloud.ram.Group("group", {comments: "this is a group comments."});
    const policy = new alicloud.ram.Policy("policy", {
        document: `    {
          "Statement": [
            {
              "Action": [
                "oss:ListObjects",
                "oss:GetObject"
              ],
              "Effect": "Allow",
              "Resource": [
                "acs:oss:*:*:mybucket",
                "acs:oss:*:*:mybucket/*"
              ]
            }
          ],
            "Version": "1"
        }
    `,
        description: "this is a policy test",
    });
    const attach = new alicloud.ram.GroupPolicyAttachment("attach", {
        policyName: policy.name,
        policyType: policy.type,
        groupName: group.name,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    # Create a RAM Group Policy attachment.
    group = alicloud.ram.Group("group", comments="this is a group comments.")
    policy = alicloud.ram.Policy("policy",
        document="""    {
          "Statement": [
            {
              "Action": [
                "oss:ListObjects",
                "oss:GetObject"
              ],
              "Effect": "Allow",
              "Resource": [
                "acs:oss:*:*:mybucket",
                "acs:oss:*:*:mybucket/*"
              ]
            }
          ],
            "Version": "1"
        }
    """,
        description="this is a policy test")
    attach = alicloud.ram.GroupPolicyAttachment("attach",
        policy_name=policy.name,
        policy_type=policy.type,
        group_name=group.name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create a RAM Group Policy attachment.
    		group, err := ram.NewGroup(ctx, "group", &ram.GroupArgs{
    			Comments: pulumi.String("this is a group comments."),
    		})
    		if err != nil {
    			return err
    		}
    		policy, err := ram.NewPolicy(ctx, "policy", &ram.PolicyArgs{
    			Document: pulumi.String(`    {
          "Statement": [
            {
              "Action": [
                "oss:ListObjects",
                "oss:GetObject"
              ],
              "Effect": "Allow",
              "Resource": [
                "acs:oss:*:*:mybucket",
                "acs:oss:*:*:mybucket/*"
              ]
            }
          ],
            "Version": "1"
        }
    `),
    			Description: pulumi.String("this is a policy test"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ram.NewGroupPolicyAttachment(ctx, "attach", &ram.GroupPolicyAttachmentArgs{
    			PolicyName: policy.Name,
    			PolicyType: policy.Type,
    			GroupName:  group.Name,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a RAM Group Policy attachment.
        var @group = new AliCloud.Ram.Group("group", new()
        {
            Comments = "this is a group comments.",
        });
    
        var policy = new AliCloud.Ram.Policy("policy", new()
        {
            Document = @"    {
          ""Statement"": [
            {
              ""Action"": [
                ""oss:ListObjects"",
                ""oss:GetObject""
              ],
              ""Effect"": ""Allow"",
              ""Resource"": [
                ""acs:oss:*:*:mybucket"",
                ""acs:oss:*:*:mybucket/*""
              ]
            }
          ],
            ""Version"": ""1""
        }
    ",
            Description = "this is a policy test",
        });
    
        var attach = new AliCloud.Ram.GroupPolicyAttachment("attach", new()
        {
            PolicyName = policy.Name,
            PolicyType = policy.Type,
            GroupName = @group.Name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ram.Group;
    import com.pulumi.alicloud.ram.GroupArgs;
    import com.pulumi.alicloud.ram.Policy;
    import com.pulumi.alicloud.ram.PolicyArgs;
    import com.pulumi.alicloud.ram.GroupPolicyAttachment;
    import com.pulumi.alicloud.ram.GroupPolicyAttachmentArgs;
    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) {
            // Create a RAM Group Policy attachment.
            var group = new Group("group", GroupArgs.builder()        
                .comments("this is a group comments.")
                .build());
    
            var policy = new Policy("policy", PolicyArgs.builder()        
                .document("""
        {
          "Statement": [
            {
              "Action": [
                "oss:ListObjects",
                "oss:GetObject"
              ],
              "Effect": "Allow",
              "Resource": [
                "acs:oss:*:*:mybucket",
                "acs:oss:*:*:mybucket/*"
              ]
            }
          ],
            "Version": "1"
        }
                """)
                .description("this is a policy test")
                .build());
    
            var attach = new GroupPolicyAttachment("attach", GroupPolicyAttachmentArgs.builder()        
                .policyName(policy.name())
                .policyType(policy.type())
                .groupName(group.name())
                .build());
    
        }
    }
    
    resources:
      # Create a RAM Group Policy attachment.
      group:
        type: alicloud:ram:Group
        properties:
          comments: this is a group comments.
      policy:
        type: alicloud:ram:Policy
        properties:
          document: |2
                {
                  "Statement": [
                    {
                      "Action": [
                        "oss:ListObjects",
                        "oss:GetObject"
                      ],
                      "Effect": "Allow",
                      "Resource": [
                        "acs:oss:*:*:mybucket",
                        "acs:oss:*:*:mybucket/*"
                      ]
                    }
                  ],
                    "Version": "1"
                }
          description: this is a policy test
      attach:
        type: alicloud:ram:GroupPolicyAttachment
        properties:
          policyName: ${policy.name}
          policyType: ${policy.type}
          groupName: ${group.name}
    

    Create GroupPolicyAttachment Resource

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

    Constructor syntax

    new GroupPolicyAttachment(name: string, args: GroupPolicyAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def GroupPolicyAttachment(resource_name: str,
                              args: GroupPolicyAttachmentArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def GroupPolicyAttachment(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              group_name: Optional[str] = None,
                              policy_name: Optional[str] = None,
                              policy_type: Optional[str] = None)
    func NewGroupPolicyAttachment(ctx *Context, name string, args GroupPolicyAttachmentArgs, opts ...ResourceOption) (*GroupPolicyAttachment, error)
    public GroupPolicyAttachment(string name, GroupPolicyAttachmentArgs args, CustomResourceOptions? opts = null)
    public GroupPolicyAttachment(String name, GroupPolicyAttachmentArgs args)
    public GroupPolicyAttachment(String name, GroupPolicyAttachmentArgs args, CustomResourceOptions options)
    
    type: alicloud:ram:GroupPolicyAttachment
    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 GroupPolicyAttachmentArgs
    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 GroupPolicyAttachmentArgs
    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 GroupPolicyAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args GroupPolicyAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args GroupPolicyAttachmentArgs
    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 groupPolicyAttachmentResource = new AliCloud.Ram.GroupPolicyAttachment("groupPolicyAttachmentResource", new()
    {
        GroupName = "string",
        PolicyName = "string",
        PolicyType = "string",
    });
    
    example, err := ram.NewGroupPolicyAttachment(ctx, "groupPolicyAttachmentResource", &ram.GroupPolicyAttachmentArgs{
    	GroupName:  pulumi.String("string"),
    	PolicyName: pulumi.String("string"),
    	PolicyType: pulumi.String("string"),
    })
    
    var groupPolicyAttachmentResource = new GroupPolicyAttachment("groupPolicyAttachmentResource", GroupPolicyAttachmentArgs.builder()        
        .groupName("string")
        .policyName("string")
        .policyType("string")
        .build());
    
    group_policy_attachment_resource = alicloud.ram.GroupPolicyAttachment("groupPolicyAttachmentResource",
        group_name="string",
        policy_name="string",
        policy_type="string")
    
    const groupPolicyAttachmentResource = new alicloud.ram.GroupPolicyAttachment("groupPolicyAttachmentResource", {
        groupName: "string",
        policyName: "string",
        policyType: "string",
    });
    
    type: alicloud:ram:GroupPolicyAttachment
    properties:
        groupName: string
        policyName: string
        policyType: string
    

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

    GroupName string
    Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    PolicyName string
    Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    PolicyType string
    Type of the RAM policy. It must be Custom or System.
    GroupName string
    Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    PolicyName string
    Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    PolicyType string
    Type of the RAM policy. It must be Custom or System.
    groupName String
    Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policyName String
    Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policyType String
    Type of the RAM policy. It must be Custom or System.
    groupName string
    Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policyName string
    Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policyType string
    Type of the RAM policy. It must be Custom or System.
    group_name str
    Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policy_name str
    Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policy_type str
    Type of the RAM policy. It must be Custom or System.
    groupName String
    Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policyName String
    Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policyType String
    Type of the RAM policy. It must be Custom or System.

    Outputs

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

    Get an existing GroupPolicyAttachment 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?: GroupPolicyAttachmentState, opts?: CustomResourceOptions): GroupPolicyAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            group_name: Optional[str] = None,
            policy_name: Optional[str] = None,
            policy_type: Optional[str] = None) -> GroupPolicyAttachment
    func GetGroupPolicyAttachment(ctx *Context, name string, id IDInput, state *GroupPolicyAttachmentState, opts ...ResourceOption) (*GroupPolicyAttachment, error)
    public static GroupPolicyAttachment Get(string name, Input<string> id, GroupPolicyAttachmentState? state, CustomResourceOptions? opts = null)
    public static GroupPolicyAttachment get(String name, Output<String> id, GroupPolicyAttachmentState 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:
    GroupName string
    Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    PolicyName string
    Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    PolicyType string
    Type of the RAM policy. It must be Custom or System.
    GroupName string
    Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    PolicyName string
    Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    PolicyType string
    Type of the RAM policy. It must be Custom or System.
    groupName String
    Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policyName String
    Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policyType String
    Type of the RAM policy. It must be Custom or System.
    groupName string
    Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policyName string
    Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policyType string
    Type of the RAM policy. It must be Custom or System.
    group_name str
    Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policy_name str
    Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policy_type str
    Type of the RAM policy. It must be Custom or System.
    groupName String
    Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policyName String
    Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
    policyType String
    Type of the RAM policy. It must be Custom or System.

    Import

    RAM Group Policy attachment can be imported using the id, e.g.

    $ pulumi import alicloud:ram/groupPolicyAttachment:GroupPolicyAttachment example group:my-policy:Custom:my-group
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi