This is a terraform provider for managing spotify playlists.
I am not affiliated with Hashicorp or Terraform.
Although it is a fork of conradludgate/terraform-provider-spotify, there are some distinct differences:
- This provider assumes that there is no auth server, accepting only an API Key
- There are no album or library resources, as this is a stripped back version initially for use in a teaching session
There is a known issue with the
publicoption that should be fixed following a migration to theterraform-plugin-framework
resource "spotify_playlist" "playlist" {
name = "Super Hot Fire Playlist"
description = "My playlist is super hot fire"
public = false
tracks = flatten([
data.spotify_track.overkill.id,
data.spotify_track.blackwater.id,
data.spotify_track.overkill.id,
data.spotify_search_track.search.tracks[*].id,
])
}
data "spotify_track" "overkill" {
url = "https://open.spotify.com/track/4XdaaDFE881SlIaz31pTAG"
}
data "spotify_track" "blackwater" {
spotify_id = "4lE6N1E0L8CssgKEUCgdbA"
}
data "spotify_search_track" "search" {
name = "Somebody Told Me"
artist = "The Killers"
album = "Hot Fuss"
}
output "test" {
value = data.spotify_search_track.search.tracks
}Add the following to your terraform configuration
terraform {
required_providers {
spotify = {
source = "brendanelmes/spotify"
version = "~> 0.1.0"
}
}
}Configure the terraform provider like so:
provider "spotify" {
api_key = var.spotify_api_key
}
variable "spotify_api_key" {
type = string
}