4 ms·
OK so I'm a little puzzled by this demo (https://learn.hashicorp.com/tutorials/terraform/spotify-playlist https://learn.hashicorp.com/tutorials/terraform/spotif
by mherdeg 4y ago
OK so I'm a little puzzled by this demo (https://learn.hashicorp.com/tutorials/terraform/spotify-playlist https://learn.hashicorp.com/tutorials/terraform/spotify-play...).
The example directive "spotify_search_track" runs a server-side search on Spotify and returns a list of results, which you can use to populate a playlist.
This is like … very cool, but also isn't it a little against the spirit of immutable infrastructure? Every time Spotify re-ranks their search results my terraform apply will populate different songs into my playlist, without anything changing in my main.tf in source control.
- electroly 4y agoMaybe, but the official serious providers do stuff like this, too. Consider the feature that lets you automatically use the latest Linux or Windows AMI; it changes without you touching your .tf file.
- caymanjim 4y agoThere's nothing that says it has to be immutable. It's not uncommon to perform similar searches in e.g. AWS to select the latest version of some AMI or another resource that is subject to change, and applying with no changes to the Terraform code would update the resource. This isn't really "infrastructure" either. It's a neat use case.
- cube2222 4y agoMoreover, you can pair it with drift detection (available in i.e. Spacelift[0]), and have it automatically detect when a data source changes (and apply the resulting infra changes). Very common scenario with lots of neat use cases around it. One of the more interesting ones - use a GitHub pull request listing data source to create an ephemeral environment for each PR. Disclaimer: Software Engineer at Spacelift [0]:https://spacelift.io https://spacelift.io
- darkwater 4y agoJust received (I hope it was by chance) a cold mail from your company today. If I might be interestes by your post here, now I'm not anymore.
- mherdeg 4y agoOK, here's my 2020 playlist materialized as code so that I can't accidentally clear it out and lose a track with no trace!: https://open.spotify.com/playlist/6NO3v396w2tZc6MnXSKNPM https://open.spotify.com/playlist/6NO3v396w2tZc6MnXSKNPM https://github.com/mherdeg/learn-terraform-spotify/blob/main/main.tf https://github.com/mherdeg/learn-terraform-spotify/blob/main...
- mherdeg 4y agoWhoops, nope, it's https://open.spotify.com/playlist/4xE4NPeiQeHNjeLL5fvYrn https://open.spotify.com/playlist/4xE4NPeiQeHNjeLL5fvYrn.
- manojlds 4y agoThat's how data sources work for serious uses as well. For example - get AWS AMI where we can pin it or let it be latest. > the spirit of immutable infrastructure Immutable means changes recreate the resources. Not that that there won't be any changes. Mutable infra is where we keep patching the same resource and potentially end up in a state where we are not able to recreate it.
- mbarneyme 4y agoI think they mean "deterministic," not "immutable"
- mherdeg 4y agoYeah on further reflection maybe the "immutable" part of this is that I never use the Spotify UI to modify my playlist - it only gets changed during terraform apply phases, which may change the playlist in random ways on each re-apply.
- nikanj 4y agoThis is very much the spirit of 2022: You don't change anything, but a butterfly flaps their wings in Tokyo, and now your build is broken.
- klabb3 4y agoAnd you can't ask the butterfly anything unless you sign an NDA.
- truetuna 4y agoIndeed. If you don't like it, prepare to get into a lot of arguments. EKS/Helm providers in combination with controllers are wild. It forces you to understand every little facet your cluster if _anything_ goes wrong.
- deleted 4y ago[deleted]