Figured i might get a quick headstart with some help. I’ve wanted to pick up go for a while, and finally have a great use case for doing this with interacting with the terraform cloud sdk.
Right now I’m just starting simple with a task that focuses on initializing a Terraform Cloud Run without me using the REST api. Instead I’ve grabbed the json payload and converted it to a struct to get me started, and now am trying to break up some simple steps of getting the organization, getting the specific workspace, etc.
Goal
- Learn some Go magic by using terraform cloud (enterprise) sdk instead of using REST based approach so I can use this in some automation tasks.
Code
Is this the proper way to share it, via playground (seems like would be useless to others in the future as temporary?).
main issues
- As I’m new to this not sure if I should pass around context to each function or create inside each function. I’ve seen examples of using
WithContext
when calling the function. I decided to ask to avoid overcomplicating it as a beginning. - I’m passing in a pointer to an initialized
client
object or just a as value scoped object? I was assuming I’d need the pointer but my first attempts failed.
Let me know if I should update this with the code too or just keep in playground and will update the thread with progress. Thanks for any help!