Resource Policy Args
data class ResourcePolicyArgs(val policy: Output<String>? = null, val resourceArn: Output<String>? = null) : ConvertibleToJava<ResourcePolicyArgs>
Creates a new Amazon Redshift Serverless Resource Policy.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.redshiftserverless.ResourcePolicy("example", {
resourceArn: exampleAwsRedshiftserverlessSnapshot.arn,
policy: JSON.stringify({
Version: "2012-10-17",
Statement: [{
Effect: "Allow",
Principal: {
AWS: ["12345678901"],
},
Action: ["redshift-serverless:RestoreFromSnapshot"],
Sid: "",
}],
}),
});
Content copied to clipboard
import pulumi
import json
import pulumi_aws as aws
example = aws.redshiftserverless.ResourcePolicy("example",
resource_arn=example_aws_redshiftserverless_snapshot["arn"],
policy=json.dumps({
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": {
"AWS": ["12345678901"],
},
"Action": ["redshift-serverless:RestoreFromSnapshot"],
"Sid": "",
}],
}))
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.RedshiftServerless.ResourcePolicy("example", new()
{
ResourceArn = exampleAwsRedshiftserverlessSnapshot.Arn,
Policy = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["Version"] = "2012-10-17",
["Statement"] = new[]
{
new Dictionary<string, object?>
{
["Effect"] = "Allow",
["Principal"] = new Dictionary<string, object?>
{
["AWS"] = new[]
{
"12345678901",
},
},
["Action"] = new[]
{
"redshift-serverless:RestoreFromSnapshot",
},
["Sid"] = "",
},
},
}),
});
});
Content copied to clipboard
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshiftserverless"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"Version": "2012-10-17",
"Statement": []map[string]interface{}{
map[string]interface{}{
"Effect": "Allow",
"Principal": map[string]interface{}{
"AWS": []string{
"12345678901",
},
},
"Action": []string{
"redshift-serverless:RestoreFromSnapshot",
},
"Sid": "",
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = redshiftserverless.NewResourcePolicy(ctx, "example", &redshiftserverless.ResourcePolicyArgs{
ResourceArn: pulumi.Any(exampleAwsRedshiftserverlessSnapshot.Arn),
Policy: pulumi.String(json0),
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.redshiftserverless.ResourcePolicy;
import com.pulumi.aws.redshiftserverless.ResourcePolicyArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 example = new ResourcePolicy("example", ResourcePolicyArgs.builder()
.resourceArn(exampleAwsRedshiftserverlessSnapshot.arn())
.policy(serializeJson(
jsonObject(
jsonProperty("Version", "2012-10-17"),
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("Effect", "Allow"),
jsonProperty("Principal", jsonObject(
jsonProperty("AWS", jsonArray("12345678901"))
)),
jsonProperty("Action", jsonArray("redshift-serverless:RestoreFromSnapshot")),
jsonProperty("Sid", "")
)))
)))
.build());
}
}
Content copied to clipboard
resources:
example:
type: aws:redshiftserverless:ResourcePolicy
properties:
resourceArn: ${exampleAwsRedshiftserverlessSnapshot.arn}
policy:
fn::toJSON:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
AWS:
- '12345678901'
Action:
- redshift-serverless:RestoreFromSnapshot
Sid: ""
Content copied to clipboard
Import
Using pulumi import
, import Redshift Serverless Resource Policies using the resource_arn
. For example:
$ pulumi import aws:redshiftserverless/resourcePolicy:ResourcePolicy example example
Content copied to clipboard