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

⭐️ new cnspec integrate experimental command #1469

Merged
merged 5 commits into from
Nov 5, 2024
Merged

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Nov 4, 2024

This is an EXPERIMENTAL command.

Our first iteration of an automated way to create integrations in the Mondoo platform. ✨

The first integration we are enabling is Azure, to do so, the user can run:

cnspec integrate azure --space <the_space_to_create_the_integration>

The flow to create an integration is:

  • Verify we have access to the Mondoo platform
  • Verify we can access Azure
  • Detect subscriptions to integrate
  • More validation like, integration name, etc.
  • Generation of automation code
  • Write code to disk
  • Run automation code with confirmation from user

Signed-off-by: Salim Afiune Maya <[email protected]>
This is an **EXPERIMENTAL** command.

Our first iteration of an automated way to create integrations in
the Mondoo platform. ✨

The first integration we are enabling is Azure, to do so, the user
can run:
```
cnspec integrate azure --space <the_space_to_create_the_integration>
```

The flow to create an integration is:

* Verify we have access to the Mondoo platform
* Verify we can access Azure
* Detect subscriptions to integrate
* More validation like, integration name, etc.
* Generation of automation code
* Write code to disk
* Run automation code with confirmation from user

Signed-off-by: Salim Afiune Maya <[email protected]>
Copy link
Contributor

github-actions bot commented Nov 4, 2024

Test Results

  1 files   25 suites   18s ⏱️
438 tests 437 ✅ 1 💤 0 ❌
439 runs  438 ✅ 1 💤 0 ❌

Results for commit 5fc36d4.

♻️ This comment has been updated with latest results.

@vjeffrey
Copy link
Contributor

vjeffrey commented Nov 5, 2024

not a blocker at all for this pr, but just curious, why not read the space from the config if it exists/if the user doesnt include the space in the command

→ loaded configuration from /Users/vj/.config/mondoo/mondoo.yml using source default
FTL unable to verify access to space '': rpc error: code = PermissionDenied desc = no valid permissions to access the resource
exit status 1

it's also worth noting folks will need an editor service account for this

Copy link
Contributor

@vjeffrey vjeffrey left a comment

Choose a reason for hiding this comment

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

🧁 this is awesome!

i was able to run the command and see all the resources tf was gonna generate.
i later failed on an error,

Error: retrieving directory role for template ID "88d8e3e3-8f55-4a1e-953a-9b9898b8876b": result was nil

not sure if you know what that means? i'm assuming it's a perms thing i dont have access to

in any case, this seems to be working well!

@afiune
Copy link
Contributor Author

afiune commented Nov 5, 2024

@vjeffrey nice suggestion! I'll add loading the space from the config with a TODO check if it is a service account, which is not really critical since the provider will fail already with:

x exit status 1

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

But I'd like to fail faster, not when we are executing the automation already.

Signed-off-by: Salim Afiune Maya <[email protected]>
@afiune afiune merged commit c3efa01 into main Nov 5, 2024
14 checks passed
@afiune afiune deleted the afiune/integrate-cmd branch November 5, 2024 07:46
@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 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.

2 participants