I have a terraform state file (terraform.tfstate
) highlighted below in Red arrow, which is stored locally in the disk.
I also have a remote backend state file (stored in Azure Blob Storage) with resources that i have deployed.
I wanted to append the existing local state file with the existing remote backend in Azure.
I moved the local state to a directory and I did perform terraform state push terraform.tfstate
I got below error:
terraform cannot import state with lineage over unrelated stage with lineage
Then i did terraform state push -force terraform.tfstate
However it completely replaced my existing state(in remote) with local state. (I did backup my remote state).
I wanted to append my local state file with remote State file. How can do this? All i wanted to have is -one single state file in remote with already provisioned resources, any other suggestion pls. help.
import
the resources in the new state file? Are both deployed with the same terraform version? Does yourmain.tf
produce resources that match the state in the local state file? Otherwise merging the state does not make sense at all since the next deployment would destroy the resources anyway. – luk2302Main.tf
underadauthservice
does create a exact match with local state file – Prasanna Nandakumar