volcengine.iam.Policy
Explore with Pulumi AI
Provides a resource to manage iam policy
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@volcengine/pulumi";
const foo = new volcengine.iam.Policy("foo", {
    description: "acc-test",
    policyDocument: "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}",
    policyName: "acc-test-policy",
});
import pulumi
import pulumi_volcengine as volcengine
foo = volcengine.iam.Policy("foo",
    description="acc-test",
    policy_document="{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}",
    policy_name="acc-test-policy")
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 {
		_, err := iam.NewPolicy(ctx, "foo", &iam.PolicyArgs{
			Description:    pulumi.String("acc-test"),
			PolicyDocument: pulumi.String("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}"),
			PolicyName:     pulumi.String("acc-test-policy"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;
return await Deployment.RunAsync(() => 
{
    var foo = new Volcengine.Iam.Policy("foo", new()
    {
        Description = "acc-test",
        PolicyDocument = "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}",
        PolicyName = "acc-test-policy",
    });
});
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 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 foo = new Policy("foo", PolicyArgs.builder()        
            .description("acc-test")
            .policyDocument("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}")
            .policyName("acc-test-policy")
            .build());
    }
}
resources:
  foo:
    type: volcengine:iam:Policy
    properties:
      description: acc-test
      policyDocument: '{"Statement":[{"Effect":"Allow","Action":["auto_scaling:DescribeScalingGroups"],"Resource":["*"]}]}'
      policyName: acc-test-policy
Create Policy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);@overload
def Policy(resource_name: str,
           args: PolicyArgs,
           opts: Optional[ResourceOptions] = None)
@overload
def Policy(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           policy_document: Optional[str] = None,
           policy_name: Optional[str] = None,
           description: Optional[str] = None)func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
public Policy(String name, PolicyArgs args)
public Policy(String name, PolicyArgs args, CustomResourceOptions options)
type: volcengine:iam:Policy
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 PolicyArgs
- 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 PolicyArgs
- 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 PolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PolicyArgs
- 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 policyResource = new Volcengine.Iam.Policy("policyResource", new()
{
    PolicyDocument = "string",
    PolicyName = "string",
    Description = "string",
});
example, err := iam.NewPolicy(ctx, "policyResource", &iam.PolicyArgs{
	PolicyDocument: pulumi.String("string"),
	PolicyName:     pulumi.String("string"),
	Description:    pulumi.String("string"),
})
var policyResource = new Policy("policyResource", PolicyArgs.builder()
    .policyDocument("string")
    .policyName("string")
    .description("string")
    .build());
policy_resource = volcengine.iam.Policy("policyResource",
    policy_document="string",
    policy_name="string",
    description="string")
const policyResource = new volcengine.iam.Policy("policyResource", {
    policyDocument: "string",
    policyName: "string",
    description: "string",
});
type: volcengine:iam:Policy
properties:
    description: string
    policyDocument: string
    policyName: string
Policy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Policy resource accepts the following input properties:
- PolicyDocument string
- The document of the Policy.
- PolicyName string
- The name of the Policy.
- Description string
- The description of the Policy.
- PolicyDocument string
- The document of the Policy.
- PolicyName string
- The name of the Policy.
- Description string
- The description of the Policy.
- policyDocument String
- The document of the Policy.
- policyName String
- The name of the Policy.
- description String
- The description of the Policy.
- policyDocument string
- The document of the Policy.
- policyName string
- The name of the Policy.
- description string
- The description of the Policy.
- policy_document str
- The document of the Policy.
- policy_name str
- The name of the Policy.
- description str
- The description of the Policy.
- policyDocument String
- The document of the Policy.
- policyName String
- The name of the Policy.
- description String
- The description of the Policy.
Outputs
All input properties are implicitly available as output properties. Additionally, the Policy resource produces the following output properties:
- CreateDate string
- The create time of the Policy.
- Id string
- The provider-assigned unique ID for this managed resource.
- PolicyTrn string
- The resource name of the Policy.
- PolicyType string
- The type of the Policy.
- UpdateDate string
- The update time of the Policy.
- CreateDate string
- The create time of the Policy.
- Id string
- The provider-assigned unique ID for this managed resource.
- PolicyTrn string
- The resource name of the Policy.
- PolicyType string
- The type of the Policy.
- UpdateDate string
- The update time of the Policy.
- createDate String
- The create time of the Policy.
- id String
- The provider-assigned unique ID for this managed resource.
- policyTrn String
- The resource name of the Policy.
- policyType String
- The type of the Policy.
- updateDate String
- The update time of the Policy.
- createDate string
- The create time of the Policy.
- id string
- The provider-assigned unique ID for this managed resource.
- policyTrn string
- The resource name of the Policy.
- policyType string
- The type of the Policy.
- updateDate string
- The update time of the Policy.
- create_date str
- The create time of the Policy.
- id str
- The provider-assigned unique ID for this managed resource.
- policy_trn str
- The resource name of the Policy.
- policy_type str
- The type of the Policy.
- update_date str
- The update time of the Policy.
- createDate String
- The create time of the Policy.
- id String
- The provider-assigned unique ID for this managed resource.
- policyTrn String
- The resource name of the Policy.
- policyType String
- The type of the Policy.
- updateDate String
- The update time of the Policy.
Look up Existing Policy Resource
Get an existing Policy 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?: PolicyState, opts?: CustomResourceOptions): Policy@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_date: Optional[str] = None,
        description: Optional[str] = None,
        policy_document: Optional[str] = None,
        policy_name: Optional[str] = None,
        policy_trn: Optional[str] = None,
        policy_type: Optional[str] = None,
        update_date: Optional[str] = None) -> Policyfunc GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)public static Policy get(String name, Output<String> id, PolicyState state, CustomResourceOptions options)resources:  _:    type: volcengine:iam:Policy    get:      id: ${id}- 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.
- CreateDate string
- The create time of the Policy.
- Description string
- The description of the Policy.
- PolicyDocument string
- The document of the Policy.
- PolicyName string
- The name of the Policy.
- PolicyTrn string
- The resource name of the Policy.
- PolicyType string
- The type of the Policy.
- UpdateDate string
- The update time of the Policy.
- CreateDate string
- The create time of the Policy.
- Description string
- The description of the Policy.
- PolicyDocument string
- The document of the Policy.
- PolicyName string
- The name of the Policy.
- PolicyTrn string
- The resource name of the Policy.
- PolicyType string
- The type of the Policy.
- UpdateDate string
- The update time of the Policy.
- createDate String
- The create time of the Policy.
- description String
- The description of the Policy.
- policyDocument String
- The document of the Policy.
- policyName String
- The name of the Policy.
- policyTrn String
- The resource name of the Policy.
- policyType String
- The type of the Policy.
- updateDate String
- The update time of the Policy.
- createDate string
- The create time of the Policy.
- description string
- The description of the Policy.
- policyDocument string
- The document of the Policy.
- policyName string
- The name of the Policy.
- policyTrn string
- The resource name of the Policy.
- policyType string
- The type of the Policy.
- updateDate string
- The update time of the Policy.
- create_date str
- The create time of the Policy.
- description str
- The description of the Policy.
- policy_document str
- The document of the Policy.
- policy_name str
- The name of the Policy.
- policy_trn str
- The resource name of the Policy.
- policy_type str
- The type of the Policy.
- update_date str
- The update time of the Policy.
- createDate String
- The create time of the Policy.
- description String
- The description of the Policy.
- policyDocument String
- The document of the Policy.
- policyName String
- The name of the Policy.
- policyTrn String
- The resource name of the Policy.
- policyType String
- The type of the Policy.
- updateDate String
- The update time of the Policy.
Import
Iam policy can be imported using the id, e.g.
$ pulumi import volcengine:iam/policy:Policy default TerraformTestPolicy
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 volcengineTerraform Provider.