You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This command should import the resource exactly to the workspace being selected.
Actual Behavior
This command creates the default workspace state behind workspaces/ directory and imports the desired resource to this one instead of importing to the selected workspace. One more weird thing: running this command for another resource, it's actually overwriting the previous one, having only the last one from these two at the end.
terraform init should init the local backend on the workspace
terraform import aws_vpc.this vpc-033184ss456 – could be any resource, this must be provider/resource independent issue.
Check out the local backend to verify the resource has been imported to the default workspace instead of the selected one.
Repeat the command on another resource to discover the fact that it overwrites the previous resource
terraform import -state-out=workspaces/[workspace_name]/terraform.tfstate aws_vpc.this vpc-033184ss456 to ensure it has been imported to the desired workspace with the flag
Additional Context
In case if this issue is really valuable and this behavior is unexpected, I'd propose two solutions:
Fix the actual problem by overriding the behavior when Terraform is being set up with workspaces
Add the quick note in documentation (I could take this over for sure)
Thank you and have a great week 🥇
The text was updated successfully, but these errors were encountered:
Terraform Version
Happens on both 0.11.x and 0.12.x.
Terraform Configuration Files
Expected Behavior
This command should import the resource exactly to the workspace being selected.
Actual Behavior
This command creates the
default
workspace state behindworkspaces/
directory and imports the desired resource to this one instead of importing to the selected workspace. One more weird thing: running this command for another resource, it's actually overwriting the previous one, having only the last one from these two at the end.Workaround out of documentation guidelines:
Steps to Reproduce
terraform init
should init the local backend on the workspaceterraform import aws_vpc.this vpc-033184ss456
– could be any resource, this must be provider/resource independent issue.default
workspace instead of the selected one.terraform import -state-out=workspaces/[workspace_name]/terraform.tfstate aws_vpc.this vpc-033184ss456
to ensure it has been imported to the desired workspace with the flagAdditional Context
In case if this issue is really valuable and this behavior is unexpected, I'd propose two solutions:
Thank you and have a great week 🥇
The text was updated successfully, but these errors were encountered: