shihanng / terraform-provider-installer

A Terraform provider to setup development environment machine.
https://registry.terraform.io/providers/shihanng/installer/latest/docs
MIT License
11 stars 3 forks source link

brew: Handle "Treating X as a formula" warning #87

Closed bilenkis closed 1 year ago

bilenkis commented 1 year ago

Hey @shihanng, thank you for the excellent piece of code, which makes me configure a couple of things I always wanted to be managed by Terraform.

This PR is a fix to an issue I had with my local run of the provider. Basically, I tried to install docker but brew threw the next error:

Warning: Treating docker as a formula. For the cask, use homebrew/cask/docker
{
  "formulae": [
    {
      "name": "docker",
      "full_name": "docker",
      "tap": "
...

As you see, the first line is a warning, which is a simple string. Therefore, the json.Unmarshal line will fail.

So, I added a simple fix and wrote a couple of unit tests to check that the fix works as expected. Feel free to test it on your machine and let me know if there's anything I can improve in terms of logic and/or code.

Thank you!