spacelift-io / terraform-provider-spacelift

Terraform provider to interact with Spacelift
MIT License
74 stars 28 forks source link

Better error message when importing missing stack #406

Closed adamconnelly closed 1 year ago

adamconnelly commented 1 year ago

Description of the change

The terraform import handling for stacks was reusing the resourceStackRead() function, which sets the ID to an empty string if no stack is found. To solve this I've pulled out query for a stack and updating the state based on a stack struct into separate functions, and I've updated the import handling to detect when the stack can't be found an output a decent error message.

I pulled the PopulateStack() function into the structs package to follow the pattern we've taken for the scheduled task structs.

Type of change

Related issues

Checklists

Development

Code review

marcinwyszynski commented 1 year ago

Task linked: CU-862j01umm Importing stack fails if stack ID does not exist