This is a terraform provider for managing your spotify playlists.
Add
The following to your terraform configuration
terraform {
required_providers {
spotify = {
version = "~> 0.1.4"
source = "conradludgate/spotify"
}
}
}
First, you need an instance of a spotify auth server running. This acts as a middleware between terraform and spotify to allow easy access to access tokens. See spotify_auth_proxy to get start.
Once you have the server running, make note of the API Key it gives you.
Configure the terraform provider like so
variable "spotify_api_key" {
type = string
}
provider "spotify" {
api_key = var.spotify_api_key
}
resource "spotify_playlist" "playlist" {
name = "My playlist"
description = "My playlist is so awesome"
public = false
tracks = [
data.spotify_track.overkill.id,
data.spotify_track.blackwater.id,
data.spotify_track.overkill.id,
]
}
data "spotify_track" "overkill" {
url = "https://open.spotify.com/track/4XdaaDFE881SlIaz31pTAG"
}
data "spotify_track" "blackwater" {
spotify_id = "4lE6N1E0L8CssgKEUCgdbA"
}