This project is my experiment with writing a custom Terraform provider. Used the documented Img Flip API.
I learned that APIs that don't have CRUD HTTP endpoints are challenging to make TF providers for, given how Terraform expects providers to work. Still, this was a fun side project
- Prerequisites - Terraform 0.12 or higher, Go 1.17
- Run
go mod init
andgo mod tidy
from project root go build -o terraform-provider-meme
&&cp terraform-provider-meme ~/.terraform.d/plugins/github.com/preetapan/meme/1.0.0/<target_arch>
- Sign up for an account at imgflip.com
- Set your user name to the env var
MEMEGEN_USERNAME
and password toMEMEGEN_USERNAME=
terraform apply
. Example output with the generated meme's URL :
Outputs:
meme_url = "https://imgflip.com/i/5zc8z1"
- The API takes a template_id and meme text. Find other meme ids at popular meme IDs
This API doesn't have delete implemented, so terraform destroy doesn't actually do anything