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

MONDOO_API_TOKEN, MONDOO_CONFIG_PATH or MONDOO_CONFIG_BASE64 need to be set #78

Closed
GurdipS5 opened this issue Apr 27, 2024 · 2 comments
Closed
Labels
enhancement New feature or request

Comments

@GurdipS5
Copy link

What is not working as you expected it?
I am trying to run Terraform for the Mondoo provider on Windows 11. I have setup cnspec and there is a config file in C:\programdata\Mondoo. I created the relevant tokens in the portal. My provider looks like below:

`terraform {
required_providers {
mondoo = {
source = "mondoohq/mondoo"
}
}
}

provider "mondoo" {
region = "eu" # use "eu" for the European region
credentials = "C:\programdata\Mondoo\mondoo.yml"
}`

The error is:

Planning failed. Terraform encountered an error while generating this plan.


│ Error: MONDOO_API_TOKEN, MONDOO_CONFIG_PATH or MONDOO_CONFIG_BASE64 need to be set

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

│ MONDOO_API_TOKEN, MONDOO_CONFIG_PATH or MONDOO_CONFIG_BASE64 need to be set

Where on the platform does it happen?
Local

How do we replicate the issue?
Replicate terraform

Expected behavior (i.e. solution)
Successful plan.

Other Comments

@chris-rock chris-rock added the enhancement New feature or request label Apr 28, 2024
@chris-rock
Copy link
Member

@GurdipS5 Thank you for the report. At this point we do not support setting the service account via the provider config. You just need to set the variable with the credential path then:

export MONDOO_CONFIG_PATH=/path/to/your/serviceaccount/youthful-meitner-435985.json

on Windows you would set it via:

$Env:MONDOO_CONFIG_PATH = "C:\programdata\Mondoo\mondoo.yml"

I'll mark your issue as an enhancement since I like the way to configure the credential path via terraform.

@preslavgerchev
Copy link
Contributor

preslavgerchev commented Jul 30, 2024

Hi @GurdipS5, thank you for reporting this.
This has been fixed with the latest (0.14.0) release. Do note the credentials is no longer the path, but the JSON service account (the contents of the file) directly. I have opened #124 as a follow-up request to also support injecting the mondoo creds via a path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants