Skip to content

Allow for instance import in the database component #96

@RedwineOS

Description

@RedwineOS

Is your feature request related to a problem? Please describe.
If I already use a MySQL database that's managed by either other IaC tools or the AWS console, in order to move to Cloud Toolkit I have to perform a data migration.

Describe the solution you'd like
I would like to import the existing component instead of doing a data migration with all the incovenients that it has. Pulumi offers an option to do so, but it requires modifications to the SDK.

Describe alternatives you've considered
Using the import Pulumi resource parameter when declaring an infrastructure component. It needs that all the parameters declared in the Pulumi component match with the ones in the deployed resource.

Additional context
The following is a hardcoded example to import an existing resource using the import Pulumi resource parameter.

onst customOpts = pulumi.mergeOptions(opts, {
      dependsOn: dependencies,
      import: this.args.existingInstance
    });

    const storage = this.args.storage || defaultStorage;

    return new aws.rds.Instance(
      `${this.name}-instance`,
      {
        identifier: this.name,
        username: "myname",
        engine: this.databaseEngine,
        engineVersion: "8.0.28",
        instanceClass: "db.t3.small",
        allocatedStorage: storage.size,
        storageType: "standard",
        backupRetentionPeriod: this.args.backup?.retentionDays,
        backupWindow: this.args.backup?.preferredWindow,
        vpcSecurityGroupIds: ["sg-123"],
        skipFinalSnapshot: true,
        dbSubnetGroupName: this.subnetGroup?.name,
      },
      customOpts
    );

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions