1
votes

I have a terraform script 'script1.tf', which uses some imported azure resources, which I hydrated with import, and this script works fine.

Next I tried to run a module using 'script1' as the source, but the module wants to recreate the imported resources. The imported resources are not managed by our team. I just want to use them without modification.

My question is in regards to using imported resource: Constraint, some resources are not managed by our team, but we need to reference in .tf file, therefore the import occurring in the directory of the working script.

For example: creating a NIC, using an already created subnet that is imported.

but now from another tf file utilizing a module, using the 'script1' as the source, I want to ignore or not update or create imported resources, but be able to use them when utilizing a module.

In this scenario it doesn't work.

In summary, A script using imported resources, works fine to create resources dependent on the imported resources. A module, using the source script, fails because it errors on recreating the externally created resources (of which we don't have rights to modify)

1

1 Answers

2
votes

When using 3rd party resources you don't want to import them into resources you define but rather use data sources that you can get information from but you can't modify. If the other team is also using Terraform you may want to look into remote state.