Skip to content

Instantly share code, notes, and snippets.

@wesen
Created May 2, 2023 21:07
Show Gist options
  • Select an option

  • Save wesen/9ced54223d82e5c309fc22df3e398e52 to your computer and use it in GitHub Desktop.

Select an option

Save wesen/9ced54223d82e5c309fc22df3e398e52 to your computer and use it in GitHub Desktop.

2023 05 02 Terraform Ecs Task

Creating the first cron-job ECS task

First AI run: first ECS task sketch

Here is my first attempt at generating some terraform from within emacs org-mode. It went quite well, I must admit.

Fumbling around a bit, trying to figure out which ttc-dbt repository to use

It turns out we already have a ttc-dbt repository, but I don’t know where this might have been created.

It looks like it’s actually in sql/dbt/main.tf, which is not an obvious location for terraform, honestly

However, I ended up just deleting the repository and creating it from scratch from inside the infra/terraform/dbt folder.

Creating the event target types

On the first apply, I got an error about a missing role_arn in the event_target, which was quickly rectified once I pointed it out. I then prompted the model for way too long, asking it to trigger the target, but that was not the proper thing to do. What you actually want to do is instantiate the task.

Triggering the rule event

Here is the conversation about creating a script to trigger the event, but as mentioned, it turns out that the proper way to do so is to create a task manually in the console.

Checking why the model was so fast, is it really GPT-4?

It answered that prompt way too fast, so I asked it to tell me which model it was, to check if it was hitting the right model. It seems that I sometimes hit a gpt-3.5-turbo? Or just a fast gpt-4.

Continue trying to trigger the event with a script

Here I ask it to reformat the script using a here string, which worked (but was useless).

Properly testing the task by instantiating it

After triggering the event and noticing I wasn’t getting very far, I asked how to test the task by prompting it with the terraform itself.

Figuring out how to pass the right arguments

Using the answer above, I was able to instantiate and test the container in the ecs cluster, and have it fail because it wasn’t providing any arguments to the dbt binary. That was quite successful already, so I was quite pleased. I then asked it how to pass those commands in, and it was kind of wrong, because it didn’t split the command into individual argument strings, but that was an easy fix.

I struggled a bit calling it locally with the env-file, and honestly I could have just looked up the docs with the CLI help, but this was worth a try.

Chaining two tasks using step function state machines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment