PolicyArgs

data class PolicyArgs(val content: Output<String>? = null, val description: Output<String>? = null, val name: Output<String>? = null, val skipDestroy: Output<Boolean>? = null, val tags: Output<Map<String, String>>? = null, val type: Output<String>? = null) : ConvertibleToJava<PolicyArgs>

Provides a resource to manage an AWS Organizations policy.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.iam.getPolicyDocument({
statements: [{
effect: "Allow",
actions: ["*"],
resources: ["*"],
}],
});
const examplePolicy = new aws.organizations.Policy("example", {
name: "example",
content: example.then(example => example.json),
});
import pulumi
import pulumi_aws as aws
example = aws.iam.get_policy_document(statements=[{
"effect": "Allow",
"actions": ["*"],
"resources": ["*"],
}])
example_policy = aws.organizations.Policy("example",
name="example",
content=example.json)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Actions = new[]
{
"*",
},
Resources = new[]
{
"*",
},
},
},
});
var examplePolicy = new Aws.Organizations.Policy("example", new()
{
Name = "example",
Content = example.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Effect: pulumi.StringRef("Allow"),
Actions: []string{
"*",
},
Resources: []string{
"*",
},
},
},
}, nil)
if err != nil {
return err
}
_, err = organizations.NewPolicy(ctx, "example", &organizations.PolicyArgs{
Name: pulumi.String("example"),
Content: pulumi.String(example.Json),
})
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.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.organizations.Policy;
import com.pulumi.aws.organizations.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) {
final var example = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("*")
.resources("*")
.build())
.build());
var examplePolicy = new Policy("examplePolicy", PolicyArgs.builder()
.name("example")
.content(example.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
}
}
resources:
examplePolicy:
type: aws:organizations:Policy
name: example
properties:
name: example
content: ${example.json}
variables:
example:
fn::invoke:
function: aws:iam:getPolicyDocument
arguments:
statements:
- effect: Allow
actions:
- '*'
resources:
- '*'

Import

Using pulumi import, import aws_organizations_policy using the policy ID. For example:

$ pulumi import aws:organizations/policy:Policy example p-12345678

Constructors

Link copied to clipboard
constructor(content: Output<String>? = null, description: Output<String>? = null, name: Output<String>? = null, skipDestroy: Output<Boolean>? = null, tags: Output<Map<String, String>>? = null, type: Output<String>? = null)

Properties

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

The policy content to add to the new policy. For example, if you create a service control policy (SCP), this string must be JSON text that specifies the permissions that admins in attached accounts can delegate to their users, groups, and roles. For more information about the RCP syntax, see the Resource Control Policy Syntax documentation. For more information about the SCP syntax, see the Service Control Policy Syntax documentation. For more information on the Tag Policy syntax, see the Tag Policy Syntax documentation.

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

A description to assign to the policy.

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

The friendly name to assign to the policy.

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

If set to true, destroy will not delete the policy and instead just remove the resource from state. This can be useful in situations where the policies (and the associated attachment) must be preserved to meet the AWS minimum requirement of 1 attached policy.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

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

The type of policy to create. Valid values are AISERVICES_OPT_OUT_POLICY, BACKUP_POLICY, RESOURCE_CONTROL_POLICY (RCP), SERVICE_CONTROL_POLICY (SCP), and TAG_POLICY. Defaults to SERVICE_CONTROL_POLICY.

Functions

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