Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cdktf-import

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cdktf-import

A CLI for importing terraform resources using CDKTF. Terraform can import existing infrastructure resources. This functionality lets you bring existing resources under Terraform management. We want to bring the same experience to CDKTF. This CLI is based

  • 0.1.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

CDKTF Import

A CLI for importing terraform resources using CDKTF. Terraform can import existing infrastructure resources. This functionality lets you bring existing resources under Terraform management. We want to bring the same experience to CDKTF. This CLI is based on the solution that comes from this comment on this Github issue.

Installation

npm i cdktf-import -g

Usage

cdktf-import <Resource_Name>.<Unique_ID> <Import_ID>

How it works

  1. Assume resources exist, write the approximate cdktf code.

  2. Change directory using this path cd cdktf.out/stacks/<stack>.

  3. Check Unique_ID in cdk.tf.json, as shown below:

        "resource": {
            "<Resource_Name>": {
                "<Unique_ID>": {
                    "//": {
                        "metadata": {
                            "path": "<Path>",
                            "uniqueId": "<Unique_ID>"
                        }
                    },
                },
            },
        },
    
  4. Initialize project by running command terraform init.

  5. Import resources using the values from the step 3 terraform import <Resource_Name>.<Unique_ID> <ID>.

  6. Change directory to cwd.

  7. Run cdktf diff <stack>.

BIG THANKS to Xing Yahao for providing the solution.

License

CDKTF Import is distributed under the MIT License. Feel free to use, modify, and distribute this library in your projects.

FAQs

Package last updated on 14 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc