PolicyArgs

data class PolicyArgs(val description: Output<String>? = null, val name: Output<String>? = null, val namePrefix: Output<String>? = null, val path: Output<String>? = null, val policy: Output<String>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<PolicyArgs>

Provides an IAM policy.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.Policy;
import com.pulumi.aws.iam.PolicyArgs;
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 policy = new Policy("policy", PolicyArgs.builder()
.path("/")
.description("My test policy")
.policy(serializeJson(
jsonObject(
jsonProperty("Version", "2012-10-17"),
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("Action", jsonArray("ec2:Describe*")),
jsonProperty("Effect", "Allow"),
jsonProperty("Resource", "*")
)))
)))
.build());
}
}

Import

IAM Policies can be imported using the arn, e.g.,

$ pulumi import aws:iam/policy:Policy administrator arn:aws:iam::123456789012:policy/UsersManageOwnCredentials

Constructors

Link copied to clipboard
constructor(description: Output<String>? = null, name: Output<String>? = null, namePrefix: Output<String>? = null, path: Output<String>? = null, policy: Output<String>? = null, tags: Output<Map<String, String>>? = null)

Properties

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

Description of the IAM policy.

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

The name of the policy. If omitted, the provider will assign a random, unique name.

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

Creates a unique name beginning with the specified prefix. Conflicts with name.

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

Path in which to create the policy. See IAM Identifiers for more information.

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

The policy document. This is a JSON formatted string.

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

Map of resource tags for the IAM Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Functions

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