Sheldon Hull

sheldonhull@macbook: ~/ (pwsh)
  • _________________________________
  • < Welcome! Thanks for stopping by >
  •  ---------------------------------
  •  \
  •   \
  •      __
  •     /  \
  •     |  |
  •     @  @
  •     |  |
  •     || |/
  •     || ||
  •     |\_/|
  •     \___/

Here you’ll find mostly tech talk and musings, with other topics periodically. If you want to stay in touch, look at the bottom for the curated newsletter I send out.

Cheers! ๐Ÿ™๐Ÿป

Go R1 Day 33

progress successfully created logging package using zerolog learned about scoping with packages linked to a private internal repository and how to leverage the module replace operator to temporarily alter path import from url to local override. middleware is a newer concept, so I need to learn more on this later so I can understand how to use to inject special log handling for http requests and other actions. Thoughts for today are that the pressure of jumping into an existing codebase is resulting in me moving faster than I probably should.

Go R1 Day 31

progress Learned a bit about idiomatic patterns wtih error handling. Learned about inline block intiailization of variables using if err := method(); err != nil {...} approach. Considered a bit more idiomatic patterns when I noticed excessibe nested if blocks. 1 2 3 4 5 6 tfdir := tf.Params().String("tfdir") if tfdir != "" { tf.Logf("tfdir set to: [%s]", tfdir) } else { tf.Errorf("๐Ÿงช failed to get tfdir parameter: [%v]", tfdir) } This would probably be more in alignment with Go standards by writing as:

Go R1 Day 30

progress Built some go functions for build tasks work with terraform and setup of projects using taskflow. Learned one one to pass in arguments using slices. I’m pretty sure you can use some stringbuilder type functionality to get similar behavior, but this worked fine for my use case. 1 2 3 4 5 6 7 8 9 10 11 cmdParams := []string{} cmdParams = append(cmdParams, "-chdir="+tfdir) cmdParams = append(cmdParams, "init") cmdParams = append(cmdParams, "-input=false") cmdParams = append(cmdParams, "-backend=true") cmdParams = append(cmdParams, "-backend-config="+tfconfig) terraformCmd := tf.

Go R1 Day 29

progress Evaluated Mage as a replacement for bash/pwsh based tasks for automation with Azure Pipelines. Was able to get terraform to run with dynamic configuration using the following approach: Install with 1 2 3 4 5 go get -u go mod init mage-build go get go get go mod tidy Then to get mage-select run: 1 2 3 GO111MODULE=off go get github.

Fix Terraform Provider Path in State

Fixing Terraform provider paths in state might be required after upgrading to 0.13-0.14 if your prior state has the following paths. First, get the terraform providers from state using: terraform providers The output should look similar to this: To fix these, try running the commands to fix state. Please adjust to the required providers your state uses, and make sure your tooling has a backup of the state file in case something goes wrong.