1. Packages
  2. Volcengine
  3. API Docs
  4. iam
  5. UserGroupPolicyAttachment
Volcengine v0.0.24 published on Tuesday, Jun 25, 2024 by Volcengine

volcengine.iam.UserGroupPolicyAttachment

Explore with Pulumi AI

volcengine logo
Volcengine v0.0.24 published on Tuesday, Jun 25, 2024 by Volcengine

    Provides a resource to manage iam user group policy attachment

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcengine = Pulumi.Volcengine;
    
    return await Deployment.RunAsync(() => 
    {
        var fooPolicy = new Volcengine.Iam.Policy("fooPolicy", new()
        {
            PolicyName = "acc-test-policy",
            Description = "acc-test",
            PolicyDocument = "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}",
        });
    
        var fooUserGroup = new Volcengine.Iam.UserGroup("fooUserGroup", new()
        {
            UserGroupName = "acc-test-group",
            Description = "acc-test",
            DisplayName = "acc-test",
        });
    
        var fooUserGroupPolicyAttachment = new Volcengine.Iam.UserGroupPolicyAttachment("fooUserGroupPolicyAttachment", new()
        {
            PolicyName = fooPolicy.PolicyName,
            PolicyType = "Custom",
            UserGroupName = fooUserGroup.UserGroupName,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/iam"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fooPolicy, err := iam.NewPolicy(ctx, "fooPolicy", &iam.PolicyArgs{
    			PolicyName:     pulumi.String("acc-test-policy"),
    			Description:    pulumi.String("acc-test"),
    			PolicyDocument: pulumi.String("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}"),
    		})
    		if err != nil {
    			return err
    		}
    		fooUserGroup, err := iam.NewUserGroup(ctx, "fooUserGroup", &iam.UserGroupArgs{
    			UserGroupName: pulumi.String("acc-test-group"),
    			Description:   pulumi.String("acc-test"),
    			DisplayName:   pulumi.String("acc-test"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = iam.NewUserGroupPolicyAttachment(ctx, "fooUserGroupPolicyAttachment", &iam.UserGroupPolicyAttachmentArgs{
    			PolicyName:    fooPolicy.PolicyName,
    			PolicyType:    pulumi.String("Custom"),
    			UserGroupName: fooUserGroup.UserGroupName,
    		})
    		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.volcengine.iam.Policy;
    import com.pulumi.volcengine.iam.PolicyArgs;
    import com.pulumi.volcengine.iam.UserGroup;
    import com.pulumi.volcengine.iam.UserGroupArgs;
    import com.pulumi.volcengine.iam.UserGroupPolicyAttachment;
    import com.pulumi.volcengine.iam.UserGroupPolicyAttachmentArgs;
    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 fooPolicy = new Policy("fooPolicy", PolicyArgs.builder()        
                .policyName("acc-test-policy")
                .description("acc-test")
                .policyDocument("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}")
                .build());
    
            var fooUserGroup = new UserGroup("fooUserGroup", UserGroupArgs.builder()        
                .userGroupName("acc-test-group")
                .description("acc-test")
                .displayName("acc-test")
                .build());
    
            var fooUserGroupPolicyAttachment = new UserGroupPolicyAttachment("fooUserGroupPolicyAttachment", UserGroupPolicyAttachmentArgs.builder()        
                .policyName(fooPolicy.policyName())
                .policyType("Custom")
                .userGroupName(fooUserGroup.userGroupName())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    foo_policy = volcengine.iam.Policy("fooPolicy",
        policy_name="acc-test-policy",
        description="acc-test",
        policy_document="{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}")
    foo_user_group = volcengine.iam.UserGroup("fooUserGroup",
        user_group_name="acc-test-group",
        description="acc-test",
        display_name="acc-test")
    foo_user_group_policy_attachment = volcengine.iam.UserGroupPolicyAttachment("fooUserGroupPolicyAttachment",
        policy_name=foo_policy.policy_name,
        policy_type="Custom",
        user_group_name=foo_user_group.user_group_name)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@volcengine/pulumi";
    
    const fooPolicy = new volcengine.iam.Policy("fooPolicy", {
        policyName: "acc-test-policy",
        description: "acc-test",
        policyDocument: "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}",
    });
    const fooUserGroup = new volcengine.iam.UserGroup("fooUserGroup", {
        userGroupName: "acc-test-group",
        description: "acc-test",
        displayName: "acc-test",
    });
    const fooUserGroupPolicyAttachment = new volcengine.iam.UserGroupPolicyAttachment("fooUserGroupPolicyAttachment", {
        policyName: fooPolicy.policyName,
        policyType: "Custom",
        userGroupName: fooUserGroup.userGroupName,
    });
    
    resources:
      fooPolicy:
        type: volcengine:iam:Policy
        properties:
          policyName: acc-test-policy
          description: acc-test
          policyDocument: '{"Statement":[{"Effect":"Allow","Action":["auto_scaling:DescribeScalingGroups"],"Resource":["*"]}]}'
      fooUserGroup:
        type: volcengine:iam:UserGroup
        properties:
          userGroupName: acc-test-group
          description: acc-test
          displayName: acc-test
      fooUserGroupPolicyAttachment:
        type: volcengine:iam:UserGroupPolicyAttachment
        properties:
          policyName: ${fooPolicy.policyName}
          policyType: Custom
          userGroupName: ${fooUserGroup.userGroupName}
    

    Create UserGroupPolicyAttachment Resource

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

    Constructor syntax

    new UserGroupPolicyAttachment(name: string, args: UserGroupPolicyAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def UserGroupPolicyAttachment(resource_name: str,
                                  args: UserGroupPolicyAttachmentArgs,
                                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def UserGroupPolicyAttachment(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  policy_name: Optional[str] = None,
                                  policy_type: Optional[str] = None,
                                  user_group_name: Optional[str] = None)
    func NewUserGroupPolicyAttachment(ctx *Context, name string, args UserGroupPolicyAttachmentArgs, opts ...ResourceOption) (*UserGroupPolicyAttachment, error)
    public UserGroupPolicyAttachment(string name, UserGroupPolicyAttachmentArgs args, CustomResourceOptions? opts = null)
    public UserGroupPolicyAttachment(String name, UserGroupPolicyAttachmentArgs args)
    public UserGroupPolicyAttachment(String name, UserGroupPolicyAttachmentArgs args, CustomResourceOptions options)
    
    type: volcengine:iam:UserGroupPolicyAttachment
    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 UserGroupPolicyAttachmentArgs
    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 UserGroupPolicyAttachmentArgs
    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 UserGroupPolicyAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args UserGroupPolicyAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args UserGroupPolicyAttachmentArgs
    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 userGroupPolicyAttachmentResource = new Volcengine.Iam.UserGroupPolicyAttachment("userGroupPolicyAttachmentResource", new()
    {
        PolicyName = "string",
        PolicyType = "string",
        UserGroupName = "string",
    });
    
    example, err := iam.NewUserGroupPolicyAttachment(ctx, "userGroupPolicyAttachmentResource", &iam.UserGroupPolicyAttachmentArgs{
    	PolicyName:    pulumi.String("string"),
    	PolicyType:    pulumi.String("string"),
    	UserGroupName: pulumi.String("string"),
    })
    
    var userGroupPolicyAttachmentResource = new UserGroupPolicyAttachment("userGroupPolicyAttachmentResource", UserGroupPolicyAttachmentArgs.builder()
        .policyName("string")
        .policyType("string")
        .userGroupName("string")
        .build());
    
    user_group_policy_attachment_resource = volcengine.iam.UserGroupPolicyAttachment("userGroupPolicyAttachmentResource",
        policy_name="string",
        policy_type="string",
        user_group_name="string")
    
    const userGroupPolicyAttachmentResource = new volcengine.iam.UserGroupPolicyAttachment("userGroupPolicyAttachmentResource", {
        policyName: "string",
        policyType: "string",
        userGroupName: "string",
    });
    
    type: volcengine:iam:UserGroupPolicyAttachment
    properties:
        policyName: string
        policyType: string
        userGroupName: string
    

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

    PolicyName string
    The policy name.
    PolicyType string
    Strategy types, System strategy, Custom strategy.
    UserGroupName string
    The user group name.
    PolicyName string
    The policy name.
    PolicyType string
    Strategy types, System strategy, Custom strategy.
    UserGroupName string
    The user group name.
    policyName String
    The policy name.
    policyType String
    Strategy types, System strategy, Custom strategy.
    userGroupName String
    The user group name.
    policyName string
    The policy name.
    policyType string
    Strategy types, System strategy, Custom strategy.
    userGroupName string
    The user group name.
    policy_name str
    The policy name.
    policy_type str
    Strategy types, System strategy, Custom strategy.
    user_group_name str
    The user group name.
    policyName String
    The policy name.
    policyType String
    Strategy types, System strategy, Custom strategy.
    userGroupName String
    The user group name.

    Outputs

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

    Get an existing UserGroupPolicyAttachment 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?: UserGroupPolicyAttachmentState, opts?: CustomResourceOptions): UserGroupPolicyAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            policy_name: Optional[str] = None,
            policy_type: Optional[str] = None,
            user_group_name: Optional[str] = None) -> UserGroupPolicyAttachment
    func GetUserGroupPolicyAttachment(ctx *Context, name string, id IDInput, state *UserGroupPolicyAttachmentState, opts ...ResourceOption) (*UserGroupPolicyAttachment, error)
    public static UserGroupPolicyAttachment Get(string name, Input<string> id, UserGroupPolicyAttachmentState? state, CustomResourceOptions? opts = null)
    public static UserGroupPolicyAttachment get(String name, Output<String> id, UserGroupPolicyAttachmentState 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
    The policy name.
    PolicyType string
    Strategy types, System strategy, Custom strategy.
    UserGroupName string
    The user group name.
    PolicyName string
    The policy name.
    PolicyType string
    Strategy types, System strategy, Custom strategy.
    UserGroupName string
    The user group name.
    policyName String
    The policy name.
    policyType String
    Strategy types, System strategy, Custom strategy.
    userGroupName String
    The user group name.
    policyName string
    The policy name.
    policyType string
    Strategy types, System strategy, Custom strategy.
    userGroupName string
    The user group name.
    policy_name str
    The policy name.
    policy_type str
    Strategy types, System strategy, Custom strategy.
    user_group_name str
    The user group name.
    policyName String
    The policy name.
    policyType String
    Strategy types, System strategy, Custom strategy.
    userGroupName String
    The user group name.

    Import

    IamUserGroupPolicyAttachment can be imported using the user group name and policy name, e.g.

     $ pulumi import volcengine:iam/userGroupPolicyAttachment:UserGroupPolicyAttachment default userGroupName:policyName
    

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

    Package Details

    Repository
    volcengine volcengine/pulumi-volcengine
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the volcengine Terraform Provider.
    volcengine logo
    Volcengine v0.0.24 published on Tuesday, Jun 25, 2024 by Volcengine