circa10a / terraform-spotify-playlist

Built off of the Hashicorp tutorial https://learn.hashicorp.com/tutorials/terraform/spotify-playlist

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🍦 mcbroken-spotify-playlist πŸŽƒ

Create a spotify playlist depending how many McDonald's ice cream machines are broken in my city, Dallas.

Implement your own by following the Hashicorp tutorial.

About the code

The tracks in the playlist created by this Terraform code is limited by the number of broken ice cream machines in Dallas, TX thanks to my mcbroken provider that builds on mcbroken.com

Example, if 11% of McDonald's ice cream machines are broken in Dallas, then guess what, you get 11 tracks. Sorry, not sorry.

Outputs:

dallas_broken_ice_cream_machines_percentage = "11.11%"
number_of_tracks = 11
tracks = toset([
  "09pk0cfDQhjtApRPV6VcdO",
  "0jPNqc1fa7rOaSsSfpqrjV",
  "171UQZHmcGOCrbgcqxD3WV",
  "1Alu6IRYqAMjl8OGOVI2GJ",
  "2WGkodmFq3psOhAZrWyF69",
  "2wjz8YVu7jINcJR5aScZlO",
  "4WQ6eIX9eRmNLc1m1OUha4",
  "5NmJ9mMDeob358RX04EUAy",
  "5pFNaXisFmJ8NW2zqc8v3c",
  "6CvDGops09TJgXItovmIrY",
  "75FfPTHYM7bQKdzUkoM3C6",
])

About the playlist

I absolutely hate Summer. It's miserable in the South. So to create a false placebo of everything not sucking around me and that Autumn is so close, I created a playlist full of Halloween songs/sounds. πŸŽƒ

But why? Well, I have an elaborate Halloween IOT project in the works ... and because most of my favored music is pretty explicit by nature 🀘

Stay tuned for the IOT write-up on my dev.to profile

Requirements

  • Docker + docker-compose
  • Terraform 1.0+

Usage

# Start local oauth-proxy
docker-compose up -d
# Get API key and Auth URL
docker logs spotify-oauth-proxy
# Next, hit the Auth URL to cache an access token in the local server
# Set the API key that was output in the logs for terraform to use
export TF_VAR_spotify_api_key=<api key>
# Install providers
terraform init
# Create the playlist
terraform apply -auto-approve

Terraform Requirements

Name Version
mcbroken 0.1.8

Providers

Name Version
mcbroken 0.1.8

Modules

Name Source Version
spotify_playlist ./modules/spotify-playlist n/a

Resources

Name Type
mcbroken_city.city data source

Inputs

Name Description Type Default Required
city What city to pull mcbroken data for string "Dallas" no
spotify_api_key Access token for spotify API calls string n/a yes

Outputs

Name Description
dallas_broken_ice_cream_machines_percentage n/a
number_of_tracks n/a
tracks n/a

About

Built off of the Hashicorp tutorial https://learn.hashicorp.com/tutorials/terraform/spotify-playlist

License:MIT License


Languages

Language:HCL 100.0%