ResourcePolicyArgs

data class ResourcePolicyArgs(val policy: Output<String>? = null, val resourceArn: Output<String>? = null) : ConvertibleToJava<ResourcePolicyArgs>

Resource for managing an AWS VPC Lattice Resource Policy.

Example Usage

Basic Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.vpclattice.ServiceNetwork;
import com.pulumi.aws.vpclattice.ResourcePolicy;
import com.pulumi.aws.vpclattice.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) {
final var currentCallerIdentity = AwsFunctions.getCallerIdentity();
final var currentPartition = AwsFunctions.getPartition();
var exampleServiceNetwork = new ServiceNetwork("exampleServiceNetwork");
var exampleResourcePolicy = new ResourcePolicy("exampleResourcePolicy", ResourcePolicyArgs.builder()
.resourceArn(exampleServiceNetwork.arn())
.policy(exampleServiceNetwork.arn().applyValue(arn -> serializeJson(
jsonObject(
jsonProperty("Version", "2012-10-17"),
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("Sid", "test-pol-principals-6"),
jsonProperty("Effect", "Allow"),
jsonProperty("Principal", jsonObject(
jsonProperty("AWS", String.format("arn:%s:iam::%s:root", currentPartition.applyValue(getPartitionResult -> getPartitionResult.partition()),currentCallerIdentity.applyValue(getCallerIdentityResult -> getCallerIdentityResult.accountId())))
)),
jsonProperty("Action", jsonArray(
"vpc-lattice:CreateServiceNetworkVpcAssociation",
"vpc-lattice:CreateServiceNetworkServiceAssociation",
"vpc-lattice:GetServiceNetwork"
)),
jsonProperty("Resource", arn)
)))
))))
.build());
}
}

Import

VPC Lattice Resource Policy can be imported using the resource_arn, e.g.,

$ pulumi import aws:vpclattice/resourcePolicy:ResourcePolicy example rft-8012925589

Constructors

Link copied to clipboard
constructor(policy: Output<String>? = null, resourceArn: Output<String>? = null)

Properties

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

An IAM policy. The policy string in JSON must not contain newlines or blank lines.

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

The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.

Functions

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