CDKTF app that deploys a Workers KV namespace to Cloudflare.
For this project you need a Cloudflare account.
Install CDKTF:
npm install -g cdktf
Install Poetry + dotenv plugin:
curl -sSL https://install.python-poetry.org | python3 -
poetry self add poetry-plugin-dotenv
Configure Poetry to create the virtualenv inside the project's root directory:
poetry config virtualenvs.in-project true
Create the virtualenv and install all the dependencies inside it:
poetry install
In order to deploy to Cloudflare, you need to create an API Token using the Edit Cloudflare Workers
template.
After that, rename .env.example
to .env
and add your variables like in the following example:
CLOUDFLARE_ACCOUNT_ID=0123456789abcdef0123456789abcdef
CLOUDFLARE_API_TOKEN=_ABCDEF_0123456789abcdef0123456789abcdef
Synthesize the Terraform stack and deploy it:
cdktf deploy
Destroy the Terraform stack:
cdktf destroy