This repository was inspired by the HashiCorp Terraform Spotify Playlist tutorial. It demonstrates how to use Terraform with the Spotify API to manage playlists programmatically.
Before you begin, ensure you have the following set up:
-
Create a Spotify App
- Visit the Spotify Developer Dashboard and create an app.
- Note down your Client ID and Client Secret.
- Set a Redirect URI for your app. For example:
http://localhost:27228/callback
-
Set up Environment Variables
- Copy
.env.exampleto.envand populate it with your Spotify app credentials:SPOTIFY_CLIENT_ID=<your-client-id> SPOTIFY_CLIENT_SECRET=<your-client-secret> SPOTIFY_REDIRECT_URI=<your-redirect-uri>
- Copy
-
Configure Terraform Variables
- Copy
terraform.tfvars.exampletoterraform.tfvarsand customize it according to your needs.
- Copy
Follow these steps to set up the project:
-
Install
pipenv:
pip install pipenv --user -
Install Python dependencies:
pipenv install -
Install the latest version of the
cdktfCLI:
npm install --global cdktf-cli@latest
Use the following commands to manage your Terraform deployment:
- Deploy the Configuration
Apply the configuration and create resources on Spotify:
cdktf deploy --var-file=terraform/terraform.tfvars - Destroy the Configuration
Remove the resources managed by Terraform:
cdktf destroy --var-file=terraform/terraform.tfvars