Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Load configuration files in YAML format #72

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Nov 17, 2024

After this change is merged, we need to update our Terraform provider since that is
where I found this bug.

With a valid Service Account in YAML format, I got:

Error: Failed to create Mondoo client

  with provider["registry.terraform.io/mondoohq/mondoo"],
  on main.tf line 10, in provider "mondoo":
  10: provider "mondoo" {

valid service account needs to be provided

With this change, I am able to use the YAML config file. ⭐

Closes #71

Closes #71

Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
go.mod Outdated
@@ -7,11 +7,11 @@ require (
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466
github.com/stretchr/testify v1.9.0
golang.org/x/oauth2 v0.23.0
gopkg.in/yaml.v3 v3.0.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally we use https://github.com/kubernetes-sigs/yaml which uses json also for yaml fields. I recommend we put gokpg.in/yaml.v3 on our blocking list and use https://github.com/kubernetes-sigs/yaml instead

PrivateKey string `json:"private_key,omitempty"`
Certificate string `json:"certificate,omitempty"`
ApiEndpoint string `json:"api_endpoint,omitempty"`
Mrn string `json:"mrn,omitempty" yaml:"mrn,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the switch to https://github.com/kubernetes-sigs/yaml this change is not required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will switch! Thanks, @chris-rock 👍🏽

Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
Copy link
Member

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement, thank you for the additional tests @afiune

@chris-rock chris-rock merged commit 6aa14c6 into main Nov 18, 2024
7 checks passed
@chris-rock chris-rock deleted the afiune/71/support-YAML branch November 18, 2024 21:42
@github-actions github-actions bot locked and limited conversation to collaborators Nov 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Unsupported cnspec configuration format (YAML)
2 participants