@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
125 lines • 4.51 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Policy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Attaches a resource based policy to a private CA.
*
* ## Example Usage
*
* ### Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = aws.iam.getPolicyDocument({
* statements: [
* {
* sid: "1",
* effect: "Allow",
* principals: [{
* type: "AWS",
* identifiers: [current.accountId],
* }],
* actions: [
* "acm-pca:DescribeCertificateAuthority",
* "acm-pca:GetCertificate",
* "acm-pca:GetCertificateAuthorityCertificate",
* "acm-pca:ListPermissions",
* "acm-pca:ListTags",
* ],
* resources: [exampleAwsAcmpcaCertificateAuthority.arn],
* },
* {
* sid: "2",
* effect: allow,
* principals: [{
* type: "AWS",
* identifiers: [current.accountId],
* }],
* actions: ["acm-pca:IssueCertificate"],
* resources: [exampleAwsAcmpcaCertificateAuthority.arn],
* conditions: [{
* test: "StringEquals",
* variable: "acm-pca:TemplateArn",
* values: ["arn:aws:acm-pca:::template/EndEntityCertificate/V1"],
* }],
* },
* ],
* });
* const examplePolicy = new aws.acmpca.Policy("example", {
* resourceArn: exampleAwsAcmpcaCertificateAuthority.arn,
* policy: example.then(example => example.json),
* });
* ```
*
* ## Import
*
* ### Identity Schema
*
* #### Required
*
* - `arn` (String) Amazon Resource Name (ARN) of the ACM PCA certificate authority.
*
* Using `pulumi import`, import `aws_acmpca_policy` using the `resource_arn` value. For example:
*
* console
*
* % pulumi import aws_acmpca_policy.example arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012
*/
class Policy extends pulumi.CustomResource {
/**
* Get an existing Policy 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 Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new Policy(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Policy. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Policy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["policy"] = state?.policy;
resourceInputs["region"] = state?.region;
resourceInputs["resourceArn"] = state?.resourceArn;
}
else {
const args = argsOrState;
if (args?.policy === undefined && !opts.urn) {
throw new Error("Missing required property 'policy'");
}
if (args?.resourceArn === undefined && !opts.urn) {
throw new Error("Missing required property 'resourceArn'");
}
resourceInputs["policy"] = args?.policy;
resourceInputs["region"] = args?.region;
resourceInputs["resourceArn"] = args?.resourceArn;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Policy.__pulumiType, name, resourceInputs, opts);
}
}
exports.Policy = Policy;
/** @internal */
Policy.__pulumiType = 'aws:acmpca/policy:Policy';
//# sourceMappingURL=policy.js.map