@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
125 lines • 4.48 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.RecorderStatus = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages status (recording / stopped) of an AWS Config Configuration Recorder.
*
* > **Note:** Starting Configuration Recorder requires a Delivery Channel to be present. Use of `dependsOn` (as shown below) is recommended to avoid race conditions.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const b = new aws.s3.Bucket("b", {bucket: "awsconfig-example"});
* const fooDeliveryChannel = new aws.cfg.DeliveryChannel("foo", {
* name: "example",
* s3BucketName: b.bucket,
* });
* const assumeRole = aws.iam.getPolicyDocument({
* statements: [{
* effect: "Allow",
* principals: [{
* type: "Service",
* identifiers: ["config.amazonaws.com"],
* }],
* actions: ["sts:AssumeRole"],
* }],
* });
* const r = new aws.iam.Role("r", {
* name: "example-awsconfig",
* assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
* });
* const fooRecorder = new aws.cfg.Recorder("foo", {
* name: "example",
* roleArn: r.arn,
* });
* const foo = new aws.cfg.RecorderStatus("foo", {
* name: fooRecorder.name,
* isEnabled: true,
* }, {
* dependsOn: [fooDeliveryChannel],
* });
* const a = new aws.iam.RolePolicyAttachment("a", {
* role: r.name,
* policyArn: "arn:aws:iam::aws:policy/service-role/AWS_ConfigRole",
* });
* const p = aws.iam.getPolicyDocumentOutput({
* statements: [{
* effect: "Allow",
* actions: ["s3:*"],
* resources: [
* b.arn,
* pulumi.interpolate`${b.arn}/*`,
* ],
* }],
* });
* const pRolePolicy = new aws.iam.RolePolicy("p", {
* name: "awsconfig-example",
* role: r.id,
* policy: p.apply(p => p.json),
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Configuration Recorder Status using the name of the Configuration Recorder. For example:
*
* ```sh
* $ pulumi import aws:cfg/recorderStatus:RecorderStatus foo example
* ```
*/
class RecorderStatus extends pulumi.CustomResource {
/**
* Get an existing RecorderStatus 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 RecorderStatus(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of RecorderStatus. 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'] === RecorderStatus.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["isEnabled"] = state?.isEnabled;
resourceInputs["name"] = state?.name;
resourceInputs["region"] = state?.region;
}
else {
const args = argsOrState;
if (args?.isEnabled === undefined && !opts.urn) {
throw new Error("Missing required property 'isEnabled'");
}
resourceInputs["isEnabled"] = args?.isEnabled;
resourceInputs["name"] = args?.name;
resourceInputs["region"] = args?.region;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RecorderStatus.__pulumiType, name, resourceInputs, opts);
}
}
exports.RecorderStatus = RecorderStatus;
/** @internal */
RecorderStatus.__pulumiType = 'aws:cfg/recorderStatus:RecorderStatus';
//# sourceMappingURL=recorderStatus.js.map