tridy
tridy

Reputation: 1284

Terraform apply on existing ARM resources. Is state needed?

Terraform v0.11.11
provider.azurerm v1.21.0

I am done with converting an ARM template into Terraform and started adding new things to TF instead of the ARM. Is it safe to apply the terraform on the existing deployment, since this is all I have got now?

And another question. Since I did not have any persisted state when using ARM templates, do I have to use the state or will Terraform diff the existing resources against the tf templates and perform a "merge"/"update"?

Do I have to import every resource separately into the state file/blob, something like this Error Importing existing resources into Terraform State File ?

Thanks

Upvotes: 0

Views: 501

Answers (1)

4c74356b41
4c74356b41

Reputation: 72191

Yes, you need to "save\gather" state before applying terraform to existing resources created outside of terraform. About it being safe - after you've added state for those to TF it will be able to tell if its going to make any changes to them.

Upvotes: 1

Related Questions