com.pulumi.aws.acmpca.Policy Maven / Gradle / Ivy
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.aws.acmpca;
import com.pulumi.aws.Utilities;
import com.pulumi.aws.acmpca.PolicyArgs;
import com.pulumi.aws.acmpca.inputs.PolicyState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import javax.annotation.Nullable;
/**
* Attaches a resource based policy to a private CA.
*
* ## Example Usage
*
* ### Basic
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* 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.acmpca.Policy;
* import com.pulumi.aws.acmpca.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()
* .sid("1")
* .effect("Allow")
* .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
* .type("AWS")
* .identifiers(current.accountId())
* .build())
* .actions(
* "acm-pca:DescribeCertificateAuthority",
* "acm-pca:GetCertificate",
* "acm-pca:GetCertificateAuthorityCertificate",
* "acm-pca:ListPermissions",
* "acm-pca:ListTags")
* .resources(exampleAwsAcmpcaCertificateAuthority.arn())
* .build(),
* GetPolicyDocumentStatementArgs.builder()
* .sid("2")
* .effect(allow)
* .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
* .type("AWS")
* .identifiers(current.accountId())
* .build())
* .actions("acm-pca:IssueCertificate")
* .resources(exampleAwsAcmpcaCertificateAuthority.arn())
* .conditions(GetPolicyDocumentStatementConditionArgs.builder()
* .test("StringEquals")
* .variable("acm-pca:TemplateArn")
* .values("arn:aws:acm-pca:::template/EndEntityCertificate/V1")
* .build())
* .build())
* .build());
*
* var examplePolicy = new Policy("examplePolicy", PolicyArgs.builder()
* .resourceArn(exampleAwsAcmpcaCertificateAuthority.arn())
* .policy(example.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Using `pulumi import`, import `aws_acmpca_policy` using the `resource_arn` value. For example:
*
* ```sh
* $ pulumi import aws:acmpca/policy:Policy example arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012
* ```
*
*/
@ResourceType(type="aws:acmpca/policy:Policy")
public class Policy extends com.pulumi.resources.CustomResource {
/**
* JSON-formatted IAM policy to attach to the specified private CA resource.
*
*/
@Export(name="policy", refs={String.class}, tree="[0]")
private Output policy;
/**
* @return JSON-formatted IAM policy to attach to the specified private CA resource.
*
*/
public Output policy() {
return this.policy;
}
/**
* ARN of the private CA to associate with the policy.
*
*/
@Export(name="resourceArn", refs={String.class}, tree="[0]")
private Output resourceArn;
/**
* @return ARN of the private CA to associate with the policy.
*
*/
public Output resourceArn() {
return this.resourceArn;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public Policy(java.lang.String name) {
this(name, PolicyArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public Policy(java.lang.String name, PolicyArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public Policy(java.lang.String name, PolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("aws:acmpca/policy:Policy", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Policy(java.lang.String name, Output id, @Nullable PolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("aws:acmpca/policy:Policy", name, state, makeResourceOptions(options, id), false);
}
private static PolicyArgs makeArgs(PolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? PolicyArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static Policy get(java.lang.String name, Output id, @Nullable PolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Policy(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy