Anish Thakur
Anish Thakur

Reputation: 25

How to import existing AWS resources like VPC using cdktf?

I can import AWS resources using AWS CDK (python) like this

   # lookup existing VPC
    vpc = ec2.Vpc.from_lookup(self,"vpc",vpc_id=vpcID,)
    
    #lookup existing Security group
    sec_group = ec2.SecurityGroup.from_lookup_by_id(self,'SG',sgID) 

I cannot find proper documentation or example of doing the same in terraform cdktf

Upvotes: 2

Views: 1337

Answers (1)

javierlga
javierlga

Reputation: 1650

CDKTF(Terraform) provides data sources to fetch information from resources created outside of Terraform, therefore you can use the DataAwsVpc method.

Upvotes: 3

Related Questions