PolicyVersionArgs

data class PolicyVersionArgs(val isDefaultVersion: Output<Boolean>? = null, val policyDocument: Output<String>? = null, val policyName: Output<String>? = null) : ConvertibleToJava<PolicyVersionArgs>

Provides a Resource Manager Policy Version resource. For information about Resource Manager Policy Version and how to use it, see What is Resource Manager Policy Version.

NOTE: Available since v1.84.0. NOTE: It is not recommended to use this resource management policy version, it is recommended to directly use the policy resource to manage your policy. Please refer to the link for usage resource_manager_policy.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "tfexample";
const example = new alicloud.resourcemanager.Policy("example", {
policyName: name,
policyDocument: `\x09\x09{
\x09\x09\x09"Statement": [{
\x09\x09\x09\x09"Action": ["oss:*"],
\x09\x09\x09\x09"Effect": "Allow",
\x09\x09\x09\x09"Resource": ["acs:oss:*:*:*"]
\x09\x09\x09}],
\x09\x09\x09"Version": "1"
\x09\x09}
`,
});
const examplePolicyVersion = new alicloud.resourcemanager.PolicyVersion("example", {
policyName: example.policyName,
policyDocument: `\x09\x09{
\x09\x09\x09"Statement": [{
\x09\x09\x09\x09"Action": ["oss:*"],
\x09\x09\x09\x09"Effect": "Allow",
\x09\x09\x09\x09"Resource": ["acs:oss:*:*:myphotos"]
\x09\x09\x09}],
\x09\x09\x09"Version": "1"
\x09\x09}
`,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tfexample"
example = alicloud.resourcemanager.Policy("example",
policy_name=name,
policy_document="""\x09\x09{
\x09\x09\x09"Statement": [{
\x09\x09\x09\x09"Action": ["oss:*"],
\x09\x09\x09\x09"Effect": "Allow",
\x09\x09\x09\x09"Resource": ["acs:oss:*:*:*"]
\x09\x09\x09}],
\x09\x09\x09"Version": "1"
\x09\x09}
""")
example_policy_version = alicloud.resourcemanager.PolicyVersion("example",
policy_name=example.policy_name,
policy_document="""\x09\x09{
\x09\x09\x09"Statement": [{
\x09\x09\x09\x09"Action": ["oss:*"],
\x09\x09\x09\x09"Effect": "Allow",
\x09\x09\x09\x09"Resource": ["acs:oss:*:*:myphotos"]
\x09\x09\x09}],
\x09\x09\x09"Version": "1"
\x09\x09}
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tfexample";
var example = new AliCloud.ResourceManager.Policy("example", new()
{
PolicyName = name,
PolicyDocument = @" {
""Statement"": [{
""Action"": [""oss:*""],
""Effect"": ""Allow"",
""Resource"": [""acs:oss:*:*:*""]
}],
""Version"": ""1""
}
",
});
var examplePolicyVersion = new AliCloud.ResourceManager.PolicyVersion("example", new()
{
PolicyName = example.PolicyName,
PolicyDocument = @" {
""Statement"": [{
""Action"": [""oss:*""],
""Effect"": ""Allow"",
""Resource"": [""acs:oss:*:*:myphotos""]
}],
""Version"": ""1""
}
",
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "tfexample"
if param := cfg.Get("name"); param != "" {
name = param
}
example, err := resourcemanager.NewPolicy(ctx, "example", &resourcemanager.PolicyArgs{
PolicyName: pulumi.String(name),
PolicyDocument: pulumi.String(` {
"Statement": [{
"Action": ["oss:*"],
"Effect": "Allow",
"Resource": ["acs:oss:*:*:*"]
}],
"Version": "1"
}
`),
})
if err != nil {
return err
}
_, err = resourcemanager.NewPolicyVersion(ctx, "example", &resourcemanager.PolicyVersionArgs{
PolicyName: example.PolicyName,
PolicyDocument: pulumi.String(` {
"Statement": [{
"Action": ["oss:*"],
"Effect": "Allow",
"Resource": ["acs:oss:*:*:myphotos"]
}],
"Version": "1"
}
`),
})
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.alicloud.resourcemanager.Policy;
import com.pulumi.alicloud.resourcemanager.PolicyArgs;
import com.pulumi.alicloud.resourcemanager.PolicyVersion;
import com.pulumi.alicloud.resourcemanager.PolicyVersionArgs;
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) {
final var config = ctx.config();
final var name = config.get("name").orElse("tfexample");
var example = new Policy("example", PolicyArgs.builder()
.policyName(name)
.policyDocument("""
{
"Statement": [{
"Action": ["oss:*"],
"Effect": "Allow",
"Resource": ["acs:oss:*:*:*"]
}],
"Version": "1"
}
""")
.build());
var examplePolicyVersion = new PolicyVersion("examplePolicyVersion", PolicyVersionArgs.builder()
.policyName(example.policyName())
.policyDocument("""
{
"Statement": [{
"Action": ["oss:*"],
"Effect": "Allow",
"Resource": ["acs:oss:*:*:myphotos"]
}],
"Version": "1"
}
""")
.build());
}
}
configuration:
name:
type: string
default: tfexample
resources:
example:
type: alicloud:resourcemanager:Policy
properties:
policyName: ${name}
policyDocument: |
{
"Statement": [{
"Action": ["oss:*"],
"Effect": "Allow",
"Resource": ["acs:oss:*:*:*"]
}],
"Version": "1"
}
examplePolicyVersion:
type: alicloud:resourcemanager:PolicyVersion
name: example
properties:
policyName: ${example.policyName}
policyDocument: |
{
"Statement": [{
"Action": ["oss:*"],
"Effect": "Allow",
"Resource": ["acs:oss:*:*:myphotos"]
}],
"Version": "1"
}

Import

Resource Manager Policy Version can be imported using the id, e.g.

$ pulumi import alicloud:resourcemanager/policyVersion:PolicyVersion example tftest:v2

Constructors

Link copied to clipboard
constructor(isDefaultVersion: Output<Boolean>? = null, policyDocument: Output<String>? = null, policyName: Output<String>? = null)

Properties

Link copied to clipboard
val isDefaultVersion: Output<Boolean>? = null

Specifies whether to set the policy version as the default version. Default to false.

Link copied to clipboard
val policyDocument: Output<String>? = null

The content of the policy. The content must be 1 to 2,048 characters in length.

Link copied to clipboard
val policyName: Output<String>? = null

The name of the policy. Name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).

Functions

Link copied to clipboard
open override fun toJava(): PolicyVersionArgs