Skip to content

✨ new resource mondoo_workspace #209

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

Merged
merged 2 commits into from
Jan 30, 2025
Merged

✨ new resource mondoo_workspace #209

merged 2 commits into from
Jan 30, 2025

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Jan 30, 2025

mondoo_workspace (Resource)

Allows management of Mondoo Workspaces.

Example Usage

provider "mondoo" {
  space = "hungry-poet-123456"
}

resource "mondoo_workspace" "my_workspace" {
  name = "My New Workspace"

  asset_selections = [
    {
      conditions = [
        {
          operator = "AND"
          key_value_condition = {
            field    = "LABELS"
            operator = "CONTAINS"
            values = [
              {
                key   = "environment"
                value = "production"
              }
            ]
          }
        },
        {
          operator = "AND"
          rating_condition = {
            field    = "RISK"
            operator = "EQUAL"
            values   = ["CRITICAL"]
          }
        },
        {
          operator = "AND"
          string_condition = {
            field    = "PLATFORM"
            operator = "EQUAL"
            values   = ["redhat", "debian"]
          }
        }
      ]
    }
  ]
}

Schema

Required

  • asset_selections (Attributes List) A list of workspace selections. (see below for nested schema)
  • name (String) Name of the workspace.

Optional

  • description (String) Description of the workspace.
  • space_id (String) Mondoo space identifier. If there is no ID, the provider space is used.

Read-Only

  • mrn (String) The Mondoo resource name (MRN) of the workspace.

Nested Schema for asset_selections

Required:

Nested Schema for asset_selections.conditions

Required:

  • operator (String) Operator determining how the condition is joined with the other conditions in the list. Valid values: AND, AND_NOT

Optional:

Nested Schema for asset_selections.conditions.int_condition

Required:

  • field (String) Numeric field to match. Valid values: ["RISK_SCORE"]
  • operator (String) Numeric operator. Valid values: ["EQUAL" "NOT_EQUAL" "GT" "LT"]
  • values (List of Number) Int values to match. Values are ORed together.

Nested Schema for asset_selections.conditions.key_value_condition

Required:

  • field (String) key:value field to match. Valid values: ["LABELS" "ANNOTATIONS"]
  • operator (String) Rating operator. Valid values: ["CONTAINS"]
  • values (Attributes List) key:value list to match. Values are ORed together. (see below for nested schema)

Nested Schema for asset_selections.conditions.key_value_condition.values

Required:

  • key (String) The key.
  • value (String) The value.

Nested Schema for asset_selections.conditions.rating_condition

Required:

  • field (String) Rating field to match. Valid values: ["RISK"]
  • operator (String) Rating operator. Valid values: ["EQUAL" "NOT_EQUAL"]
  • values (List of String) Int values to match. Values are ORed together.

Nested Schema for asset_selections.conditions.string_condition

Required:

  • field (String) String field to match. Valid values: ["PLATFORM" "PLATFORM_VERSION" "ASSET_NAME" "ASSET_KIND" "TECHNOLOGY"]
  • operator (String) String operator. Valid values: ["EQUAL" "NOT_EQUAL" "CONTAINS"]
  • values (List of String) String values to match. Values are ORed together.

Signed-off-by: Salim Afiune Maya <[email protected]>
page_title: "mondoo_workspace Resource - terraform-provider-mondoo"
subcategory: ""
description: |-
Allows management of Mondoo Workspaces.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Allows management of Mondoo Workspaces.
Allows management of Mondoo workspaces.


### Required

- `asset_selections` (Attributes List) A list of workspace selections. (see [below for nested schema](#nestedatt--asset_selections))
Copy link
Contributor

@misterpantz misterpantz Jan 30, 2025

Choose a reason for hiding this comment

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

Suggested change
- `asset_selections` (Attributes List) A list of workspace selections. (see [below for nested schema](#nestedatt--asset_selections))
- `asset_selections` (Attributes List) A list of workspace selections. (See [below for nested schema](#nestedatt--asset_selections).)


Required:

- `conditions` (Attributes List) A list of conditions for the selection. (see [below for nested schema](#nestedatt--asset_selections--conditions))
Copy link
Contributor

@misterpantz misterpantz Jan 30, 2025

Choose a reason for hiding this comment

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

Suggested change
- `conditions` (Attributes List) A list of conditions for the selection. (see [below for nested schema](#nestedatt--asset_selections--conditions))
- `conditions` (Attributes List) A list of conditions for the selection. (See [below for nested schema](#nestedatt--asset_selections--conditions).)


Optional:

- `int_condition` (Attributes) A condition with values of type int. (see [below for nested schema](#nestedatt--asset_selections--conditions--int_condition))
Copy link
Contributor

@misterpantz misterpantz Jan 30, 2025

Choose a reason for hiding this comment

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

Suggested change
- `int_condition` (Attributes) A condition with values of type int. (see [below for nested schema](#nestedatt--asset_selections--conditions--int_condition))
- `int_condition` (Attributes) A condition with values of type int. (See [below for nested schema](#nestedatt--asset_selections--conditions--int_condition).)

Optional:

- `int_condition` (Attributes) A condition with values of type int. (see [below for nested schema](#nestedatt--asset_selections--conditions--int_condition))
- `key_value_condition` (Attributes) A condition with values of type key:value. (see [below for nested schema](#nestedatt--asset_selections--conditions--key_value_condition))
Copy link
Contributor

@misterpantz misterpantz Jan 30, 2025

Choose a reason for hiding this comment

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

Suggested change
- `key_value_condition` (Attributes) A condition with values of type key:value. (see [below for nested schema](#nestedatt--asset_selections--conditions--key_value_condition))
- `key_value_condition` (Attributes) A condition with values of type key:value. (See [below for nested schema](#nestedatt--asset_selections--conditions--key_value_condition).)


- `int_condition` (Attributes) A condition with values of type int. (see [below for nested schema](#nestedatt--asset_selections--conditions--int_condition))
- `key_value_condition` (Attributes) A condition with values of type key:value. (see [below for nested schema](#nestedatt--asset_selections--conditions--key_value_condition))
- `rating_condition` (Attributes) A condition with values of type int. (see [below for nested schema](#nestedatt--asset_selections--conditions--rating_condition))
Copy link
Contributor

@misterpantz misterpantz Jan 30, 2025

Choose a reason for hiding this comment

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

Suggested change
- `rating_condition` (Attributes) A condition with values of type int. (see [below for nested schema](#nestedatt--asset_selections--conditions--rating_condition))
- `rating_condition` (Attributes) A condition with values of type int. (See [below for nested schema](#nestedatt--asset_selections--conditions--rating_condition).)

- `int_condition` (Attributes) A condition with values of type int. (see [below for nested schema](#nestedatt--asset_selections--conditions--int_condition))
- `key_value_condition` (Attributes) A condition with values of type key:value. (see [below for nested schema](#nestedatt--asset_selections--conditions--key_value_condition))
- `rating_condition` (Attributes) A condition with values of type int. (see [below for nested schema](#nestedatt--asset_selections--conditions--rating_condition))
- `string_condition` (Attributes) A condition with values of type string. (see [below for nested schema](#nestedatt--asset_selections--conditions--string_condition))
Copy link
Contributor

@misterpantz misterpantz Jan 30, 2025

Choose a reason for hiding this comment

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

Suggested change
- `string_condition` (Attributes) A condition with values of type string. (see [below for nested schema](#nestedatt--asset_selections--conditions--string_condition))
- `string_condition` (Attributes) A condition with values of type string. (See [below for nested schema](#nestedatt--asset_selections--conditions--string_condition).)


- `field` (String) key:value field to match. Valid values: ["LABELS" "ANNOTATIONS"]
- `operator` (String) Rating operator. Valid values: ["CONTAINS"]
- `values` (Attributes List) key:value list to match. Values are ORed together. (see [below for nested schema](#nestedatt--asset_selections--conditions--key_value_condition--values))
Copy link
Contributor

@misterpantz misterpantz Jan 30, 2025

Choose a reason for hiding this comment

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

Suggested change
- `values` (Attributes List) key:value list to match. Values are ORed together. (see [below for nested schema](#nestedatt--asset_selections--conditions--key_value_condition--values))
- `values` (Attributes List) key:value list to match. Values are ORed together. (See [below for nested schema](#nestedatt--asset_selections--conditions--key_value_condition--values).)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of these changes see > See are part of the code generator, I will try to see if I can change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh rats! Well it would be great if you can... but of course it's not the end of the world. 😃

@misterpantz
Copy link
Contributor

So nicely documented! I just nitpicked on capitalization.

@afiune
Copy link
Contributor Author

afiune commented Jan 30, 2025

@misterpantz here is the change in the tool we use to auto generate the documentation

hashicorp/terraform-plugin-docs#442

Signed-off-by: Salim Afiune Maya <[email protected]>
@afiune afiune merged commit 445ffbc into main Jan 30, 2025
19 checks passed
@afiune afiune deleted the afiune/workspace branch January 30, 2025 21:31
@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2025
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.

3 participants