This project involves using Terraform to create multiple Spotify playlists for different occasions like morning, evening, party night, etc. Terraform will be used to automate the creation and management of these playlists.
- Terraform Installed: Ensure Terraform is installed on your machine.
- Docker Installed: Make sure Docker is installed and running.
- Spotify Account: You need a Spotify account (without premium access)
- Spotify Developer Account: Register and create an application to get the Client ID and Client Secret.
- Spotify Provider for Terraform: Install and configure the Spotify provider for Terraform.
- VS Code Editor: Recommended for editing Terraform files.
- Creating Terraform Code Start by setting up your Terraform project. Create a new directory for your Terraform project and navigate to it in your terminal. Create a file named main.tf.
- Define Provider In main.tf, define the Spotify provider:
provider "spotify" {
api_key = "?"
}
To interact with Spotify's API, you need a Client ID and Client Secret.
- Go to the Spotify Developer Dashboard.
- Log in with your Spotify account.
- Click on "Create an App".
Create a file named .env to store your Spotify application's Client ID and Secret:
SPOTIFY_CLIENT_ID=<your_spotify_client_id>
SPOTIFY_CLIENT_SECRET=<your_spotify_client_secret>
Make sure Docker Desktop is running, and start the authorization proxy server:
docker run --rm -it -p 27228:27228 --env-file .env ghcr.io/conradludgate/spotify-auth-proxy
- Continue Creating Terraform Code
-
Initialize the Terraform configuration:
terraform init
-
Apply the Terraform configuration:
terraform plan
terraform apply -auto-approve
After applying the Terraform configuration, log in to your Spotify account and verify that the playlists have been created and populated with the specified tracks.