Intro
This manual is dedicated to resolve issue with importing resources into Terraform Enterprise state when VCS or API driven approach is used
Problem description
When VCS or API driven approach is used it is not possible to modify state to import resources. However, there is still a way to do it.
Solution
-
Download the state file
-
Reconfigure the code to not use any remote backend
-
Run the
terraform init
locally with the state file still in the same directory -
Execute the tasks to import or remove the resource from the state file
-
Re-upload the state file via Terraform Init
-
Reconfigure the Terraform Code with the remote backend again
-
Re-run the
terraform init
(It should offer the option to migrate the backend) via State Version -
Reconfigure the remote backend
-
Put the local state file aside
-
Re-run the
terraform init