Understand
Problem Statement
As a TFE engineer, I want to create a single, global ULID stored in Postgres so that all go-census agents in a TFE installation share the same ProcessID.
Understood Answer
What is.....
- TFE Engineer: Me.
- Create: bring in thing into existence.
- Single: One.
- Global: in this context this means accessible throughout the program.
- ULID: Kinda like a UUID accept with different features. None of which I can name.
- Stored in Postgres: Well Postgres is a database management system and stored means to retain or enter for electronic retrieval.
- go-census: census means an official count or survey of population and Go is a programming language. So together that means we use the Go programming language to count or survey the population of an object
- agents: "intelligent" entities that are capable of making decisions, taking actions, and interacting with their environment. So they are a thing in an application that do things for you given some sort of input.
- Terraform Enterprise: self-hosted instance of terraform cloud.
- Installation: place in position for use
converted response given what you think you know.
I want to create one, accessible anywhere, ProcessID that is a ULID and store it in PostgreSQL so that the go-census agents will share the same ProcessID
Plan
Create a function that generates the process ID. The function should do the following:
- Connect to the PostgreSQL database.
- If the is an error connecting to the data return an an empty ULID and the error
- Close the connection when the function is done.
- Check if there is a ULID present
- If no rows are found on the table return the error