Terraform import

I am using azure blob storage as state successfully I think, can see it updated and terraform.tfstate pointing to it

const stack = new MyStack(app, 'typescript-azure');
new AzurermBackend(stack, {
  resourceGroupName  : sa_rg_name,
  storageAccountName : sa_name,
  containerName       : sa_container,
  key                  : sa_key,
});

When I imported KeyVault to my remote state (using terraform out of band) I can see cdk wants to remove it or create new one if I try ‘new KeyVault’ with same name and parameters in the code (and always remove imported oob;). So my question is how do I hack import correctly ?

Names are currently auto generated within cdktf. If you take a look at the json file generated by synth, you can see what name was generated for your resource. At that point you should be able to use terraform import to get it in.

1 Like

That’s is smart, appreciate !