"use strict";
// *** 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.DbInstance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * The ``AWS::RDS::DBInstance`` resource creates an Amazon DB instance. The new DB instance can be an RDS DB instance, or it can be a DB instance in an Aurora DB cluster.
 *  For more information about creating an RDS DB instance, see [Creating an Amazon RDS DB instance](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CreateDBInstance.html) in the *Amazon RDS User Guide*.
 *  For more information about creating a DB instance in an Aurora DB cluster, see [Creating an Amazon Aurora DB cluster](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.CreateInstance.html) in the *Amazon Aurora User Guide*.
 *  If you import an existing DB instance, and the template configuration doesn't match the actual configuration of the DB instance, AWS CloudFormation applies the changes in the template during the import operation.
 *   If a DB instance is deleted or replaced during an update, AWS CloudFormation deletes all automated snapshots. However, it retains manual DB snapshots. During an update that requires replacement, you can apply a stack policy to prevent DB instances from being replaced. For more information, see [Prevent Updates to Stack Resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/protect-stack-resources.html).
 *    *Updating DB instances*
 *  When properties labeled "*Update requires:* [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)" are updated, AWS CloudFormation first creates a replacement DB instance, then changes references from other dependent resources to point to the replacement DB instance, and finally deletes the old DB instance.
 *   We highly recommend that you take a snapshot of the database before updating the stack. If you don't, you lose the data when AWS CloudFormation replaces your DB instance. To preserve your data, perform the following procedure:
 *   1.  Deactivate any applications that are using the DB instance so that there's no activity on the DB instance.
 *   2.  Create a snapshot of the DB instance. For more information, see [Creating a DB Snapshot](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CreateSnapshot.html).
 *   3.  If you want to restore your instance using a DB snapshot, modify the updated template with your DB instance changes and add the ``DBSnapshotIdentifier`` property with the ID of the DB snapshot that you want to use.
 *        After you restore a DB instance with a ``DBSnapshotIdentifier`` property, you can delete the ``DBSnapshotIdentifier`` property. When you specify this property for an update, the DB instance is not restored from the DB snapshot again, and the data in the database is not changed. However, if you don't specify the ``DBSnapshotIdentifier`` property, an empty DB instance is created, and the original DB instance is deleted. If you specify a property that is different from the previous snapshot restore property, a new DB instance is restored from the specified ``DBSnapshotIdentifier`` property, and the original DB instance is deleted.
 *   4.  Update the stack.
 *
 *   For more information about updating other properties of this resource, see ``ModifyDBInstance``. For more information about updating stacks, see [CloudFormation Stacks Updates](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks.html).
 *   *Deleting DB instances*
 *  For DB instances that are part of an Aurora DB cluster, you can set a deletion policy for your DB instance to control how AWS CloudFormation handles the DB instance when the stack is deleted. For Amazon RDS DB instances, you can choose to *retain* the DB instance, to *delete* the DB instance, or to *create a snapshot* of the DB instance. The default AWS CloudFormation behavior depends on the ``DBClusterIdentifier`` property:
 *   1.  For ``AWS::RDS::DBInstance`` resources that don't specify the ``DBClusterIdentifier`` property, AWS CloudFormation saves a snapshot of the DB instance.
 *   2.   For ``AWS::RDS::DBInstance`` resources that do specify the ``DBClusterIdentifier`` property, AWS CloudFormation deletes the DB instance.
 *
 *   For more information, see [DeletionPolicy Attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html).
 */
class DbInstance extends pulumi.CustomResource {
    /**
     * Get an existing DbInstance 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 opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, opts) {
        return new DbInstance(name, undefined, Object.assign(Object.assign({}, opts), { id: id }));
    }
    /**
     * Returns true if the given object is an instance of DbInstance.  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'] === DbInstance.__pulumiType;
    }
    /**
     * Create a DbInstance resource with the given unique name, arguments, and options.
     *
     * @param name The _unique_ name of the resource.
     * @param args The arguments to use to populate this resource's properties.
     * @param opts A bag of options that control this resource's behavior.
     */
    constructor(name, args, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (!opts.id) {
            resourceInputs["allocatedStorage"] = args ? args.allocatedStorage : undefined;
            resourceInputs["allowMajorVersionUpgrade"] = args ? args.allowMajorVersionUpgrade : undefined;
            resourceInputs["applyImmediately"] = args ? args.applyImmediately : undefined;
            resourceInputs["associatedRoles"] = args ? args.associatedRoles : undefined;
            resourceInputs["autoMinorVersionUpgrade"] = args ? args.autoMinorVersionUpgrade : undefined;
            resourceInputs["automaticBackupReplicationKmsKeyId"] = args ? args.automaticBackupReplicationKmsKeyId : undefined;
            resourceInputs["automaticBackupReplicationRegion"] = args ? args.automaticBackupReplicationRegion : undefined;
            resourceInputs["automaticBackupReplicationRetentionPeriod"] = args ? args.automaticBackupReplicationRetentionPeriod : undefined;
            resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined;
            resourceInputs["backupRetentionPeriod"] = args ? args.backupRetentionPeriod : undefined;
            resourceInputs["caCertificateIdentifier"] = args ? args.caCertificateIdentifier : undefined;
            resourceInputs["certificateRotationRestart"] = args ? args.certificateRotationRestart : undefined;
            resourceInputs["characterSetName"] = args ? args.characterSetName : undefined;
            resourceInputs["copyTagsToSnapshot"] = args ? args.copyTagsToSnapshot : undefined;
            resourceInputs["customIamInstanceProfile"] = args ? args.customIamInstanceProfile : undefined;
            resourceInputs["dbClusterIdentifier"] = args ? args.dbClusterIdentifier : undefined;
            resourceInputs["dbClusterSnapshotIdentifier"] = args ? args.dbClusterSnapshotIdentifier : undefined;
            resourceInputs["dbInstanceClass"] = args ? args.dbInstanceClass : undefined;
            resourceInputs["dbInstanceIdentifier"] = args ? args.dbInstanceIdentifier : undefined;
            resourceInputs["dbName"] = args ? args.dbName : undefined;
            resourceInputs["dbParameterGroupName"] = args ? args.dbParameterGroupName : undefined;
            resourceInputs["dbSecurityGroups"] = args ? args.dbSecurityGroups : undefined;
            resourceInputs["dbSnapshotIdentifier"] = args ? args.dbSnapshotIdentifier : undefined;
            resourceInputs["dbSubnetGroupName"] = args ? args.dbSubnetGroupName : undefined;
            resourceInputs["dbSystemId"] = args ? args.dbSystemId : undefined;
            resourceInputs["dedicatedLogVolume"] = args ? args.dedicatedLogVolume : undefined;
            resourceInputs["deleteAutomatedBackups"] = args ? args.deleteAutomatedBackups : undefined;
            resourceInputs["deletionProtection"] = args ? args.deletionProtection : undefined;
            resourceInputs["domain"] = args ? args.domain : undefined;
            resourceInputs["domainAuthSecretArn"] = args ? args.domainAuthSecretArn : undefined;
            resourceInputs["domainDnsIps"] = args ? args.domainDnsIps : undefined;
            resourceInputs["domainFqdn"] = args ? args.domainFqdn : undefined;
            resourceInputs["domainIamRoleName"] = args ? args.domainIamRoleName : undefined;
            resourceInputs["domainOu"] = args ? args.domainOu : undefined;
            resourceInputs["enableCloudwatchLogsExports"] = args ? args.enableCloudwatchLogsExports : undefined;
            resourceInputs["enableIamDatabaseAuthentication"] = args ? args.enableIamDatabaseAuthentication : undefined;
            resourceInputs["enablePerformanceInsights"] = args ? args.enablePerformanceInsights : undefined;
            resourceInputs["engine"] = args ? args.engine : undefined;
            resourceInputs["engineLifecycleSupport"] = args ? args.engineLifecycleSupport : undefined;
            resourceInputs["engineVersion"] = args ? args.engineVersion : undefined;
            resourceInputs["iops"] = args ? args.iops : undefined;
            resourceInputs["kmsKeyId"] = args ? args.kmsKeyId : undefined;
            resourceInputs["licenseModel"] = args ? args.licenseModel : undefined;
            resourceInputs["manageMasterUserPassword"] = args ? args.manageMasterUserPassword : undefined;
            resourceInputs["masterUserPassword"] = args ? args.masterUserPassword : undefined;
            resourceInputs["masterUserSecret"] = args ? args.masterUserSecret : undefined;
            resourceInputs["masterUsername"] = args ? args.masterUsername : undefined;
            resourceInputs["maxAllocatedStorage"] = args ? args.maxAllocatedStorage : undefined;
            resourceInputs["monitoringInterval"] = args ? args.monitoringInterval : undefined;
            resourceInputs["monitoringRoleArn"] = args ? args.monitoringRoleArn : undefined;
            resourceInputs["multiAz"] = args ? args.multiAz : undefined;
            resourceInputs["ncharCharacterSetName"] = args ? args.ncharCharacterSetName : undefined;
            resourceInputs["networkType"] = args ? args.networkType : undefined;
            resourceInputs["optionGroupName"] = args ? args.optionGroupName : undefined;
            resourceInputs["performanceInsightsKmsKeyId"] = args ? args.performanceInsightsKmsKeyId : undefined;
            resourceInputs["performanceInsightsRetentionPeriod"] = args ? args.performanceInsightsRetentionPeriod : undefined;
            resourceInputs["port"] = args ? args.port : undefined;
            resourceInputs["preferredBackupWindow"] = args ? args.preferredBackupWindow : undefined;
            resourceInputs["preferredMaintenanceWindow"] = args ? args.preferredMaintenanceWindow : undefined;
            resourceInputs["processorFeatures"] = args ? args.processorFeatures : undefined;
            resourceInputs["promotionTier"] = args ? args.promotionTier : undefined;
            resourceInputs["publiclyAccessible"] = args ? args.publiclyAccessible : undefined;
            resourceInputs["replicaMode"] = args ? args.replicaMode : undefined;
            resourceInputs["restoreTime"] = args ? args.restoreTime : undefined;
            resourceInputs["sourceDbClusterIdentifier"] = args ? args.sourceDbClusterIdentifier : undefined;
            resourceInputs["sourceDbInstanceAutomatedBackupsArn"] = args ? args.sourceDbInstanceAutomatedBackupsArn : undefined;
            resourceInputs["sourceDbInstanceIdentifier"] = args ? args.sourceDbInstanceIdentifier : undefined;
            resourceInputs["sourceDbiResourceId"] = args ? args.sourceDbiResourceId : undefined;
            resourceInputs["sourceRegion"] = args ? args.sourceRegion : undefined;
            resourceInputs["storageEncrypted"] = args ? args.storageEncrypted : undefined;
            resourceInputs["storageThroughput"] = args ? args.storageThroughput : undefined;
            resourceInputs["storageType"] = args ? args.storageType : undefined;
            resourceInputs["tags"] = args ? args.tags : undefined;
            resourceInputs["tdeCredentialArn"] = args ? args.tdeCredentialArn : undefined;
            resourceInputs["tdeCredentialPassword"] = args ? args.tdeCredentialPassword : undefined;
            resourceInputs["timezone"] = args ? args.timezone : undefined;
            resourceInputs["useDefaultProcessorFeatures"] = args ? args.useDefaultProcessorFeatures : undefined;
            resourceInputs["useLatestRestorableTime"] = args ? args.useLatestRestorableTime : undefined;
            resourceInputs["vpcSecurityGroups"] = args ? args.vpcSecurityGroups : undefined;
            resourceInputs["certificateDetails"] = undefined /*out*/;
            resourceInputs["databaseInsightsMode"] = undefined /*out*/;
            resourceInputs["dbInstanceArn"] = undefined /*out*/;
            resourceInputs["dbiResourceId"] = undefined /*out*/;
            resourceInputs["endpoint"] = undefined /*out*/;
        }
        else {
            resourceInputs["allocatedStorage"] = undefined /*out*/;
            resourceInputs["allowMajorVersionUpgrade"] = undefined /*out*/;
            resourceInputs["applyImmediately"] = undefined /*out*/;
            resourceInputs["associatedRoles"] = undefined /*out*/;
            resourceInputs["autoMinorVersionUpgrade"] = undefined /*out*/;
            resourceInputs["automaticBackupReplicationKmsKeyId"] = undefined /*out*/;
            resourceInputs["automaticBackupReplicationRegion"] = undefined /*out*/;
            resourceInputs["automaticBackupReplicationRetentionPeriod"] = undefined /*out*/;
            resourceInputs["availabilityZone"] = undefined /*out*/;
            resourceInputs["backupRetentionPeriod"] = undefined /*out*/;
            resourceInputs["caCertificateIdentifier"] = undefined /*out*/;
            resourceInputs["certificateDetails"] = undefined /*out*/;
            resourceInputs["certificateRotationRestart"] = undefined /*out*/;
            resourceInputs["characterSetName"] = undefined /*out*/;
            resourceInputs["copyTagsToSnapshot"] = undefined /*out*/;
            resourceInputs["customIamInstanceProfile"] = undefined /*out*/;
            resourceInputs["databaseInsightsMode"] = undefined /*out*/;
            resourceInputs["dbClusterIdentifier"] = undefined /*out*/;
            resourceInputs["dbClusterSnapshotIdentifier"] = undefined /*out*/;
            resourceInputs["dbInstanceArn"] = undefined /*out*/;
            resourceInputs["dbInstanceClass"] = undefined /*out*/;
            resourceInputs["dbInstanceIdentifier"] = undefined /*out*/;
            resourceInputs["dbName"] = undefined /*out*/;
            resourceInputs["dbParameterGroupName"] = undefined /*out*/;
            resourceInputs["dbSecurityGroups"] = undefined /*out*/;
            resourceInputs["dbSnapshotIdentifier"] = undefined /*out*/;
            resourceInputs["dbSubnetGroupName"] = undefined /*out*/;
            resourceInputs["dbSystemId"] = undefined /*out*/;
            resourceInputs["dbiResourceId"] = undefined /*out*/;
            resourceInputs["dedicatedLogVolume"] = undefined /*out*/;
            resourceInputs["deleteAutomatedBackups"] = undefined /*out*/;
            resourceInputs["deletionProtection"] = undefined /*out*/;
            resourceInputs["domain"] = undefined /*out*/;
            resourceInputs["domainAuthSecretArn"] = undefined /*out*/;
            resourceInputs["domainDnsIps"] = undefined /*out*/;
            resourceInputs["domainFqdn"] = undefined /*out*/;
            resourceInputs["domainIamRoleName"] = undefined /*out*/;
            resourceInputs["domainOu"] = undefined /*out*/;
            resourceInputs["enableCloudwatchLogsExports"] = undefined /*out*/;
            resourceInputs["enableIamDatabaseAuthentication"] = undefined /*out*/;
            resourceInputs["enablePerformanceInsights"] = undefined /*out*/;
            resourceInputs["endpoint"] = undefined /*out*/;
            resourceInputs["engine"] = undefined /*out*/;
            resourceInputs["engineLifecycleSupport"] = undefined /*out*/;
            resourceInputs["engineVersion"] = undefined /*out*/;
            resourceInputs["iops"] = undefined /*out*/;
            resourceInputs["kmsKeyId"] = undefined /*out*/;
            resourceInputs["licenseModel"] = undefined /*out*/;
            resourceInputs["manageMasterUserPassword"] = undefined /*out*/;
            resourceInputs["masterUserPassword"] = undefined /*out*/;
            resourceInputs["masterUserSecret"] = undefined /*out*/;
            resourceInputs["masterUsername"] = undefined /*out*/;
            resourceInputs["maxAllocatedStorage"] = undefined /*out*/;
            resourceInputs["monitoringInterval"] = undefined /*out*/;
            resourceInputs["monitoringRoleArn"] = undefined /*out*/;
            resourceInputs["multiAz"] = undefined /*out*/;
            resourceInputs["ncharCharacterSetName"] = undefined /*out*/;
            resourceInputs["networkType"] = undefined /*out*/;
            resourceInputs["optionGroupName"] = undefined /*out*/;
            resourceInputs["performanceInsightsKmsKeyId"] = undefined /*out*/;
            resourceInputs["performanceInsightsRetentionPeriod"] = undefined /*out*/;
            resourceInputs["port"] = undefined /*out*/;
            resourceInputs["preferredBackupWindow"] = undefined /*out*/;
            resourceInputs["preferredMaintenanceWindow"] = undefined /*out*/;
            resourceInputs["processorFeatures"] = undefined /*out*/;
            resourceInputs["promotionTier"] = undefined /*out*/;
            resourceInputs["publiclyAccessible"] = undefined /*out*/;
            resourceInputs["replicaMode"] = undefined /*out*/;
            resourceInputs["restoreTime"] = undefined /*out*/;
            resourceInputs["sourceDbClusterIdentifier"] = undefined /*out*/;
            resourceInputs["sourceDbInstanceAutomatedBackupsArn"] = undefined /*out*/;
            resourceInputs["sourceDbInstanceIdentifier"] = undefined /*out*/;
            resourceInputs["sourceDbiResourceId"] = undefined /*out*/;
            resourceInputs["sourceRegion"] = undefined /*out*/;
            resourceInputs["storageEncrypted"] = undefined /*out*/;
            resourceInputs["storageThroughput"] = undefined /*out*/;
            resourceInputs["storageType"] = undefined /*out*/;
            resourceInputs["tags"] = undefined /*out*/;
            resourceInputs["tdeCredentialArn"] = undefined /*out*/;
            resourceInputs["tdeCredentialPassword"] = undefined /*out*/;
            resourceInputs["timezone"] = undefined /*out*/;
            resourceInputs["useDefaultProcessorFeatures"] = undefined /*out*/;
            resourceInputs["useLatestRestorableTime"] = undefined /*out*/;
            resourceInputs["vpcSecurityGroups"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const replaceOnChanges = { replaceOnChanges: ["characterSetName", "customIamInstanceProfile", "dbClusterIdentifier", "dbInstanceIdentifier", "dbName", "dbSubnetGroupName", "dbSystemId", "kmsKeyId", "masterUsername", "ncharCharacterSetName", "sourceRegion", "storageEncrypted", "timezone"] };
        opts = pulumi.mergeOptions(opts, replaceOnChanges);
        super(DbInstance.__pulumiType, name, resourceInputs, opts);
    }
}
exports.DbInstance = DbInstance;
/** @internal */
DbInstance.__pulumiType = 'aws-native:rds:DbInstance';
//# sourceMappingURL=dbInstance.js.map