@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
123 lines • 5.94 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.ReservedInstance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an RDS DB Reserved Instance.
*
* > **NOTE:** Once created, a reservation is valid for the `duration` of the provided `offeringId` and cannot be deleted. Performing a `destroy` will only remove the resource from state. For more information see [RDS Reserved Instances Documentation](https://aws.amazon.com/rds/reserved-instances/) and [PurchaseReservedDBInstancesOffering](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_PurchaseReservedDBInstancesOffering.html).
*
* > **NOTE:** Due to the expense of testing this resource, we provide it as best effort. If you find it useful, and have the ability to help test or notice issues, consider reaching out to us on GitHub.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const test = aws.rds.getReservedInstanceOffering({
* dbInstanceClass: "db.t2.micro",
* duration: 31536000,
* multiAz: false,
* offeringType: "All Upfront",
* productDescription: "mysql",
* });
* const example = new aws.rds.ReservedInstance("example", {
* offeringId: test.then(test => test.offeringId),
* reservationId: "optionalCustomReservationID",
* instanceCount: 3,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import RDS DB Instance Reservations using the `instance_id`. For example:
*
* ```sh
* $ pulumi import aws:rds/reservedInstance:ReservedInstance reservation_instance CustomReservationID
* ```
*/
class ReservedInstance extends pulumi.CustomResource {
/**
* Get an existing ReservedInstance 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 ReservedInstance(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ReservedInstance. 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'] === ReservedInstance.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["currencyCode"] = state?.currencyCode;
resourceInputs["dbInstanceClass"] = state?.dbInstanceClass;
resourceInputs["duration"] = state?.duration;
resourceInputs["fixedPrice"] = state?.fixedPrice;
resourceInputs["instanceCount"] = state?.instanceCount;
resourceInputs["leaseId"] = state?.leaseId;
resourceInputs["multiAz"] = state?.multiAz;
resourceInputs["offeringId"] = state?.offeringId;
resourceInputs["offeringType"] = state?.offeringType;
resourceInputs["productDescription"] = state?.productDescription;
resourceInputs["recurringCharges"] = state?.recurringCharges;
resourceInputs["region"] = state?.region;
resourceInputs["reservationId"] = state?.reservationId;
resourceInputs["startTime"] = state?.startTime;
resourceInputs["state"] = state?.state;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["usagePrice"] = state?.usagePrice;
}
else {
const args = argsOrState;
if (args?.offeringId === undefined && !opts.urn) {
throw new Error("Missing required property 'offeringId'");
}
resourceInputs["instanceCount"] = args?.instanceCount;
resourceInputs["offeringId"] = args?.offeringId;
resourceInputs["region"] = args?.region;
resourceInputs["reservationId"] = args?.reservationId;
resourceInputs["tags"] = args?.tags;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["currencyCode"] = undefined /*out*/;
resourceInputs["dbInstanceClass"] = undefined /*out*/;
resourceInputs["duration"] = undefined /*out*/;
resourceInputs["fixedPrice"] = undefined /*out*/;
resourceInputs["leaseId"] = undefined /*out*/;
resourceInputs["multiAz"] = undefined /*out*/;
resourceInputs["offeringType"] = undefined /*out*/;
resourceInputs["productDescription"] = undefined /*out*/;
resourceInputs["recurringCharges"] = undefined /*out*/;
resourceInputs["startTime"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["usagePrice"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ReservedInstance.__pulumiType, name, resourceInputs, opts);
}
}
exports.ReservedInstance = ReservedInstance;
/** @internal */
ReservedInstance.__pulumiType = 'aws:rds/reservedInstance:ReservedInstance';
//# sourceMappingURL=reservedInstance.js.map
;