published on Tuesday, Mar 10, 2026 by Pulumi
published on Tuesday, Mar 10, 2026 by Pulumi
Attaches a resource based policy to a private CA.
Example Usage
Basic
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var examplePolicyDocument = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Sid = "1",
Effect = "Allow",
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "AWS",
Identifiers = new[]
{
data.Aws_caller_identity.Current.Account_id,
},
},
},
Actions = new[]
{
"acm-pca:DescribeCertificateAuthority",
"acm-pca:GetCertificate",
"acm-pca:GetCertificateAuthorityCertificate",
"acm-pca:ListPermissions",
"acm-pca:ListTags",
},
Resources = new[]
{
aws_acmpca_certificate_authority.Example.Arn,
},
},
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Sid = "2",
Effect = Allow,
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "AWS",
Identifiers = new[]
{
data.Aws_caller_identity.Current.Account_id,
},
},
},
Actions = new[]
{
"acm-pca:IssueCertificate",
},
Resources = new[]
{
aws_acmpca_certificate_authority.Example.Arn,
},
Conditions = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementConditionInputArgs
{
Test = "StringEquals",
Variable = "acm-pca:TemplateArn",
Values = new[]
{
"arn:aws:acm-pca:::template/EndEntityCertificate/V1",
},
},
},
},
},
});
var examplePolicy = new Aws.Acmpca.Policy("examplePolicy", new()
{
ResourceArn = aws_acmpca_certificate_authority.Example.Arn,
PolicyDetails = examplePolicyDocument.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
});
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/acmpca"
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
examplePolicyDocument, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Sid: pulumi.StringRef("1"),
Effect: pulumi.StringRef("Allow"),
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "AWS",
Identifiers: interface{}{
data.Aws_caller_identity.Current.Account_id,
},
},
},
Actions: []string{
"acm-pca:DescribeCertificateAuthority",
"acm-pca:GetCertificate",
"acm-pca:GetCertificateAuthorityCertificate",
"acm-pca:ListPermissions",
"acm-pca:ListTags",
},
Resources: interface{}{
aws_acmpca_certificate_authority.Example.Arn,
},
},
{
Sid: pulumi.StringRef("2"),
Effect: pulumi.StringRef(Allow),
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "AWS",
Identifiers: interface{}{
data.Aws_caller_identity.Current.Account_id,
},
},
},
Actions: []string{
"acm-pca:IssueCertificate",
},
Resources: interface{}{
aws_acmpca_certificate_authority.Example.Arn,
},
Conditions: []iam.GetPolicyDocumentStatementCondition{
{
Test: "StringEquals",
Variable: "acm-pca:TemplateArn",
Values: []string{
"arn:aws:acm-pca:::template/EndEntityCertificate/V1",
},
},
},
},
},
}, nil);
if err != nil {
return err
}
_, err = acmpca.NewPolicy(ctx, "examplePolicy", &acmpca.PolicyArgs{
ResourceArn: pulumi.Any(aws_acmpca_certificate_authority.Example.Arn),
Policy: *pulumi.String(examplePolicyDocument.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.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 examplePolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(
GetPolicyDocumentStatementArgs.builder()
.sid("1")
.effect("Allow")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("AWS")
.identifiers(data.aws_caller_identity().current().account_id())
.build())
.actions(
"acm-pca:DescribeCertificateAuthority",
"acm-pca:GetCertificate",
"acm-pca:GetCertificateAuthorityCertificate",
"acm-pca:ListPermissions",
"acm-pca:ListTags")
.resources(aws_acmpca_certificate_authority.example().arn())
.build(),
GetPolicyDocumentStatementArgs.builder()
.sid("2")
.effect(Allow)
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("AWS")
.identifiers(data.aws_caller_identity().current().account_id())
.build())
.actions("acm-pca:IssueCertificate")
.resources(aws_acmpca_certificate_authority.example().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(aws_acmpca_certificate_authority.example().arn())
.policy(examplePolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const examplePolicyDocument = aws.iam.getPolicyDocument({
statements: [
{
sid: "1",
effect: "Allow",
principals: [{
type: "AWS",
identifiers: [data.aws_caller_identity.current.account_id],
}],
actions: [
"acm-pca:DescribeCertificateAuthority",
"acm-pca:GetCertificate",
"acm-pca:GetCertificateAuthorityCertificate",
"acm-pca:ListPermissions",
"acm-pca:ListTags",
],
resources: [aws_acmpca_certificate_authority.example.arn],
},
{
sid: "2",
effect: Allow,
principals: [{
type: "AWS",
identifiers: [data.aws_caller_identity.current.account_id],
}],
actions: ["acm-pca:IssueCertificate"],
resources: [aws_acmpca_certificate_authority.example.arn],
conditions: [{
test: "StringEquals",
variable: "acm-pca:TemplateArn",
values: ["arn:aws:acm-pca:::template/EndEntityCertificate/V1"],
}],
},
],
});
const examplePolicy = new aws.acmpca.Policy("examplePolicy", {
resourceArn: aws_acmpca_certificate_authority.example.arn,
policy: examplePolicyDocument.then(examplePolicyDocument => examplePolicyDocument.json),
});
import pulumi
import pulumi_aws as aws
example_policy_document = aws.iam.get_policy_document(statements=[
aws.iam.GetPolicyDocumentStatementArgs(
sid="1",
effect="Allow",
principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
type="AWS",
identifiers=[data["aws_caller_identity"]["current"]["account_id"]],
)],
actions=[
"acm-pca:DescribeCertificateAuthority",
"acm-pca:GetCertificate",
"acm-pca:GetCertificateAuthorityCertificate",
"acm-pca:ListPermissions",
"acm-pca:ListTags",
],
resources=[aws_acmpca_certificate_authority["example"]["arn"]],
),
aws.iam.GetPolicyDocumentStatementArgs(
sid="2",
effect=allow,
principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
type="AWS",
identifiers=[data["aws_caller_identity"]["current"]["account_id"]],
)],
actions=["acm-pca:IssueCertificate"],
resources=[aws_acmpca_certificate_authority["example"]["arn"]],
conditions=[aws.iam.GetPolicyDocumentStatementConditionArgs(
test="StringEquals",
variable="acm-pca:TemplateArn",
values=["arn:aws:acm-pca:::template/EndEntityCertificate/V1"],
)],
),
])
example_policy = aws.acmpca.Policy("examplePolicy",
resource_arn=aws_acmpca_certificate_authority["example"]["arn"],
policy=example_policy_document.json)
resources:
examplePolicy:
type: aws:acmpca:Policy
properties:
resourceArn: ${aws_acmpca_certificate_authority.example.arn}
policy: ${examplePolicyDocument.json}
variables:
examplePolicyDocument:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- sid: '1'
effect: Allow
principals:
- type: AWS
identifiers:
- ${data.aws_caller_identity.current.account_id}
actions:
- acm-pca:DescribeCertificateAuthority
- acm-pca:GetCertificate
- acm-pca:GetCertificateAuthorityCertificate
- acm-pca:ListPermissions
- acm-pca:ListTags
resources:
- ${aws_acmpca_certificate_authority.example.arn}
- sid: '2'
effect: ${Allow}
principals:
- type: AWS
identifiers:
- ${data.aws_caller_identity.current.account_id}
actions:
- acm-pca:IssueCertificate
resources:
- ${aws_acmpca_certificate_authority.example.arn}
conditions:
- test: StringEquals
variable: acm-pca:TemplateArn
values:
- arn:aws:acm-pca:::template/EndEntityCertificate/V1
Create Policy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);@overload
def Policy(resource_name: str,
args: PolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Policy(resource_name: str,
opts: Optional[ResourceOptions] = None,
policy: Optional[str] = None,
resource_arn: Optional[str] = None)func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
public Policy(String name, PolicyArgs args)
public Policy(String name, PolicyArgs args, CustomResourceOptions options)
type: aws:acmpca:Policy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var policyResource = new Aws.Acmpca.Policy("policyResource", new()
{
PolicyDetails = "string",
ResourceArn = "string",
});
example, err := acmpca.NewPolicy(ctx, "policyResource", &acmpca.PolicyArgs{
Policy: pulumi.String("string"),
ResourceArn: pulumi.String("string"),
})
var policyResource = new com.pulumi.aws.acmpca.Policy("policyResource", com.pulumi.aws.acmpca.PolicyArgs.builder()
.policy("string")
.resourceArn("string")
.build());
policy_resource = aws.acmpca.Policy("policyResource",
policy="string",
resource_arn="string")
const policyResource = new aws.acmpca.Policy("policyResource", {
policy: "string",
resourceArn: "string",
});
type: aws:acmpca:Policy
properties:
policy: string
resourceArn: string
Policy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Policy resource accepts the following input properties:
- Policy
Details string - JSON-formatted IAM policy to attach to the specified private CA resource.
- Resource
Arn string - ARN of the private CA to associate with the policy.
- Policy string
- JSON-formatted IAM policy to attach to the specified private CA resource.
- Resource
Arn string - ARN of the private CA to associate with the policy.
- policy String
- JSON-formatted IAM policy to attach to the specified private CA resource.
- resource
Arn String - ARN of the private CA to associate with the policy.
- policy string
- JSON-formatted IAM policy to attach to the specified private CA resource.
- resource
Arn string - ARN of the private CA to associate with the policy.
- policy str
- JSON-formatted IAM policy to attach to the specified private CA resource.
- resource_
arn str - ARN of the private CA to associate with the policy.
- policy String
- JSON-formatted IAM policy to attach to the specified private CA resource.
- resource
Arn String - ARN of the private CA to associate with the policy.
Outputs
All input properties are implicitly available as output properties. Additionally, the Policy resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Policy Resource
Get an existing Policy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: PolicyState, opts?: CustomResourceOptions): Policy@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
policy: Optional[str] = None,
resource_arn: Optional[str] = None) -> Policyfunc GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)public static Policy get(String name, Output<String> id, PolicyState state, CustomResourceOptions options)resources: _: type: aws:acmpca:Policy get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Policy
Details string - JSON-formatted IAM policy to attach to the specified private CA resource.
- Resource
Arn string - ARN of the private CA to associate with the policy.
- Policy string
- JSON-formatted IAM policy to attach to the specified private CA resource.
- Resource
Arn string - ARN of the private CA to associate with the policy.
- policy String
- JSON-formatted IAM policy to attach to the specified private CA resource.
- resource
Arn String - ARN of the private CA to associate with the policy.
- policy string
- JSON-formatted IAM policy to attach to the specified private CA resource.
- resource
Arn string - ARN of the private CA to associate with the policy.
- policy str
- JSON-formatted IAM policy to attach to the specified private CA resource.
- resource_
arn str - ARN of the private CA to associate with the policy.
- policy String
- JSON-formatted IAM policy to attach to the specified private CA resource.
- resource
Arn String - ARN of the private CA to associate with the policy.
Import
aws_acmpca_policy can be imported using the resource_arn value.
$ pulumi import aws:acmpca/policy:Policy example arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
published on Tuesday, Mar 10, 2026 by Pulumi
