alicloud.resourcemanager.PolicyAttachment
Explore with Pulumi AI
Provides a Resource Manager Policy Attachment resource to attaches a policy to an object. After you attach a policy to an object, the object has the operation permissions on the current resource group or the resources under the current account. For information about Resource Manager Policy Attachment and how to use it, see How to authorize and manage resource groups.
NOTE: Available since v1.93.0.
Create PolicyAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new PolicyAttachment(name: string, args: PolicyAttachmentArgs, opts?: CustomResourceOptions);
@overload
def PolicyAttachment(resource_name: str,
args: PolicyAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def PolicyAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
policy_name: Optional[str] = None,
policy_type: Optional[str] = None,
principal_name: Optional[str] = None,
principal_type: Optional[str] = None,
resource_group_id: Optional[str] = None)
func NewPolicyAttachment(ctx *Context, name string, args PolicyAttachmentArgs, opts ...ResourceOption) (*PolicyAttachment, error)
public PolicyAttachment(string name, PolicyAttachmentArgs args, CustomResourceOptions? opts = null)
public PolicyAttachment(String name, PolicyAttachmentArgs args)
public PolicyAttachment(String name, PolicyAttachmentArgs args, CustomResourceOptions options)
type: alicloud:resourcemanager:PolicyAttachment
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 PolicyAttachmentArgs
- 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 PolicyAttachmentArgs
- 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 PolicyAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PolicyAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PolicyAttachmentArgs
- 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 policyAttachmentResource = new AliCloud.ResourceManager.PolicyAttachment("policyAttachmentResource", new()
{
PolicyName = "string",
PolicyType = "string",
PrincipalName = "string",
PrincipalType = "string",
ResourceGroupId = "string",
});
example, err := resourcemanager.NewPolicyAttachment(ctx, "policyAttachmentResource", &resourcemanager.PolicyAttachmentArgs{
PolicyName: pulumi.String("string"),
PolicyType: pulumi.String("string"),
PrincipalName: pulumi.String("string"),
PrincipalType: pulumi.String("string"),
ResourceGroupId: pulumi.String("string"),
})
var policyAttachmentResource = new PolicyAttachment("policyAttachmentResource", PolicyAttachmentArgs.builder()
.policyName("string")
.policyType("string")
.principalName("string")
.principalType("string")
.resourceGroupId("string")
.build());
policy_attachment_resource = alicloud.resourcemanager.PolicyAttachment("policyAttachmentResource",
policy_name="string",
policy_type="string",
principal_name="string",
principal_type="string",
resource_group_id="string")
const policyAttachmentResource = new alicloud.resourcemanager.PolicyAttachment("policyAttachmentResource", {
policyName: "string",
policyType: "string",
principalName: "string",
principalType: "string",
resourceGroupId: "string",
});
type: alicloud:resourcemanager:PolicyAttachment
properties:
policyName: string
policyType: string
principalName: string
principalType: string
resourceGroupId: string
PolicyAttachment 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 PolicyAttachment resource accepts the following input properties:
- Policy
Name string - The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- Policy
Type string - The type of the policy. Valid values:
Custom
,System
. - Principal
Name string - The name of the object to which you want to attach the policy.
- Principal
Type string - The type of the object to which you want to attach the policy. Valid values:
IMSUser
: RAM user,IMSGroup
: RAM user group,ServiceRole
: RAM role. - Resource
Group stringId - The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- Policy
Name string - The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- Policy
Type string - The type of the policy. Valid values:
Custom
,System
. - Principal
Name string - The name of the object to which you want to attach the policy.
- Principal
Type string - The type of the object to which you want to attach the policy. Valid values:
IMSUser
: RAM user,IMSGroup
: RAM user group,ServiceRole
: RAM role. - Resource
Group stringId - The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- policy
Name String - The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policy
Type String - The type of the policy. Valid values:
Custom
,System
. - principal
Name String - The name of the object to which you want to attach the policy.
- principal
Type String - The type of the object to which you want to attach the policy. Valid values:
IMSUser
: RAM user,IMSGroup
: RAM user group,ServiceRole
: RAM role. - resource
Group StringId - The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- policy
Name string - The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policy
Type string - The type of the policy. Valid values:
Custom
,System
. - principal
Name string - The name of the object to which you want to attach the policy.
- principal
Type string - The type of the object to which you want to attach the policy. Valid values:
IMSUser
: RAM user,IMSGroup
: RAM user group,ServiceRole
: RAM role. - resource
Group stringId - The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- policy_
name str - The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policy_
type str - The type of the policy. Valid values:
Custom
,System
. - principal_
name str - The name of the object to which you want to attach the policy.
- principal_
type str - The type of the object to which you want to attach the policy. Valid values:
IMSUser
: RAM user,IMSGroup
: RAM user group,ServiceRole
: RAM role. - resource_
group_ strid - The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- policy
Name String - The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policy
Type String - The type of the policy. Valid values:
Custom
,System
. - principal
Name String - The name of the object to which you want to attach the policy.
- principal
Type String - The type of the object to which you want to attach the policy. Valid values:
IMSUser
: RAM user,IMSGroup
: RAM user group,ServiceRole
: RAM role. - resource
Group StringId - The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
Outputs
All input properties are implicitly available as output properties. Additionally, the PolicyAttachment 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 PolicyAttachment Resource
Get an existing PolicyAttachment 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?: PolicyAttachmentState, opts?: CustomResourceOptions): PolicyAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
policy_name: Optional[str] = None,
policy_type: Optional[str] = None,
principal_name: Optional[str] = None,
principal_type: Optional[str] = None,
resource_group_id: Optional[str] = None) -> PolicyAttachment
func GetPolicyAttachment(ctx *Context, name string, id IDInput, state *PolicyAttachmentState, opts ...ResourceOption) (*PolicyAttachment, error)
public static PolicyAttachment Get(string name, Input<string> id, PolicyAttachmentState? state, CustomResourceOptions? opts = null)
public static PolicyAttachment get(String name, Output<String> id, PolicyAttachmentState 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.
- Policy
Name string - The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- Policy
Type string - The type of the policy. Valid values:
Custom
,System
. - Principal
Name string - The name of the object to which you want to attach the policy.
- Principal
Type string - The type of the object to which you want to attach the policy. Valid values:
IMSUser
: RAM user,IMSGroup
: RAM user group,ServiceRole
: RAM role. - Resource
Group stringId - The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- Policy
Name string - The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- Policy
Type string - The type of the policy. Valid values:
Custom
,System
. - Principal
Name string - The name of the object to which you want to attach the policy.
- Principal
Type string - The type of the object to which you want to attach the policy. Valid values:
IMSUser
: RAM user,IMSGroup
: RAM user group,ServiceRole
: RAM role. - Resource
Group stringId - The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- policy
Name String - The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policy
Type String - The type of the policy. Valid values:
Custom
,System
. - principal
Name String - The name of the object to which you want to attach the policy.
- principal
Type String - The type of the object to which you want to attach the policy. Valid values:
IMSUser
: RAM user,IMSGroup
: RAM user group,ServiceRole
: RAM role. - resource
Group StringId - The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- policy
Name string - The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policy
Type string - The type of the policy. Valid values:
Custom
,System
. - principal
Name string - The name of the object to which you want to attach the policy.
- principal
Type string - The type of the object to which you want to attach the policy. Valid values:
IMSUser
: RAM user,IMSGroup
: RAM user group,ServiceRole
: RAM role. - resource
Group stringId - The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- policy_
name str - The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policy_
type str - The type of the policy. Valid values:
Custom
,System
. - principal_
name str - The name of the object to which you want to attach the policy.
- principal_
type str - The type of the object to which you want to attach the policy. Valid values:
IMSUser
: RAM user,IMSGroup
: RAM user group,ServiceRole
: RAM role. - resource_
group_ strid - The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- policy
Name String - The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policy
Type String - The type of the policy. Valid values:
Custom
,System
. - principal
Name String - The name of the object to which you want to attach the policy.
- principal
Type String - The type of the object to which you want to attach the policy. Valid values:
IMSUser
: RAM user,IMSGroup
: RAM user group,ServiceRole
: RAM role. - resource
Group StringId - The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
Import
Resource Manager Policy Attachment can be imported using the id, e.g.
$ pulumi import alicloud:resourcemanager/policyAttachment:PolicyAttachment example tf-testaccrdpolicy:Custom:tf-testaccrdpolicy@11827252********.onaliyun.com:IMSUser:rg******
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.