terraform cdk: importing resources

122 views Asked by At

i have most of my infrastructure build out using Terraform. I would like to add a new resource (Azure ContainerApp Job), but try doing so with cdktf.
To do so, i would need to import the dependent resources i think:

-resource group -azure container app environment and app environment storage -azure container registry

I read that this is possible here: https://developer.hashicorp.com/terraform/cdktf/concepts/resources#how-to-import

From the code at that link, i am not sure though what 'id' means in context of azure resources. i dont see an id for a resource group on azure portal for example. as a simple test, i have written this simple python code:

rg = ResourceGroup(self, 'rg_test_id', name=self.rg_name).import_from(id=self.rg_name)
TerraformOutput(self, 'rg_id', value=rg.id)

But when debugging, rg is None after the first line and so the 2nd obviously fails.

any documentation or help on how this should be done would be helpful.

thanks

0

There are 0 answers