conradludgate/terraform-provider-spotify

Support for resource import?

Closed this issue · 6 comments

sirhc commented

Are there plans to support state import for playlists? I was thinking of managing all of my Spotify playlists with this and it would be nice to import the playlists I've already made.

I've started looking at forking and trying this implementation myself, but wanted to see if there is already a roadmap for this.

Yeah that's an awesome idea. Should definitely be possible to support. I think I'd probably want to pair it with a script that can create the terraform resource block for you too (for some very big playlists).

I'm happy if you want to give it a go!

sirhc commented

As a first pass, it turned out to be remarkably simple to add import functionality. I'm still poking around to see if this is all that would be required. I'm also thinking through what I would want the paired script to do. Would it be enough to capture the imported state object, or maybe map all of the tracks to data blocks.

https://github.com/sirhc/terraform-provider-spotify/commit/693a83d8932a6cea8fed1ef3602bf562f008fa44

Interesting, it looks very simple. I'll give it a test.

As for the script. It would act similar to the read resource step. It would get the list of tracks, then it would be output using a text template into a terraform file. I say don't worry about it for now. We can get your changes tested and merged in on its own

sirhc commented

Cool. I'll drop it into a PR to make it easier to work with.

Merged in #17 I'll get a release out at some point

Released in v0.1.9