I have a bit of a dummy question. First of all a bit of context:
I am using terraform cloud and have two workspaces called mydata_old
and mydata_new
. My goal is to do a partial workspace migration from mydata_old
to mydata_new
meaning that I want some of the configuration to now only exist to mydata_new and get removed from mydata_old
. Is there any way just by looking at a state file example here to know exactly which import commands you have to execute?
Just looking at the old state is not complete information to know exactly which import command to execute... but it can help you build it, you need to know the Terraform resources in the new workspace.
Let's use as an example that state file example you provided:
https://github.com/mdb/terraform-example/blob/master/terraform/terraform.tfstate
One of the resources there is:
and let's assume your new terraform code for that resource is something like:
According to the documentation we can import using the S3 url...
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_object#import
here is how that import command will look like