Back to Documentation
Example Usage
resource "spotify_playlist" "example" {
name = "My Playlist with Custom Cover"
description = "A playlist with a custom cover image"
public = true
}
resource "spotify_playlist_cover" "example_cover" {
playlist_id = spotify_playlist.example.id
background_color = "#FF5500"
emoji = "🎵"
}
Dynamic Cover Example
data "spotify_weather" "current" {}
data "spotify_time" "now" {}
resource "spotify_playlist" "dynamic" {
name = "${data.spotify_weather.current.mood} ${data.spotify_time.now.time_of_day} Mix"
description = "Auto-generated based on weather and time of day"
public = true
}
resource "spotify_playlist_cover" "dynamic_cover" {
playlist_id = spotify_playlist.dynamic.id
mood = data.spotify_weather.current.mood
weather = data.spotify_weather.current.condition
force_update = true
}
Argument Reference
| Argument |
Description |
playlist_id |
(Required) The Spotify ID of the playlist. |
background_color |
(Optional) The background color for the cover image in hex format (e.g., "#FF5500"). |
text |
(Optional) Text to display on the cover image. |
emoji |
(Optional) An emoji to display on the cover image. |
mood |
(Optional) A mood to use for generating a themed cover image (e.g., "chill", "energetic"). |
weather |
(Optional) A weather condition to use for generating a themed cover image (e.g., "sunny", "rainy"). |
image_url |
(Optional) A URL to an image to use as the cover image. |
force_update |
(Optional) Whether to force an update of the cover image even if the arguments haven't changed. Useful for dynamic covers that should change regularly. Defaults to false. |
Attribute Reference
| Attribute |
Description |
id |
A unique identifier for this resource, composed of the playlist ID and a hash of the configuration. |
url |
The URL of the generated cover image. |
last_updated |
The timestamp of when the cover image was last updated. |