topfunky / terraform-provider-spotify

Terraform provider for spotify

Home Page:https://registry.terraform.io/providers/conradludgate/spotify/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

terraform-provider-spotify

This is a terraform provider for managing your spotify playlists.

Installation

Add

The following to your terraform configuration

terraform {
  required_providers {
    spotify = {
      version = "~> 0.1.4"
      source  = "conradludgate/spotify"
    }
  }
}

How to use

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
}

Example

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"
}

About

Terraform provider for spotify

https://registry.terraform.io/providers/conradludgate/spotify/latest


Languages

Language:Go 100.0%