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

Prevent multiple resources from managing the state of a single policy #44

Open
scottford-io opened this issue Feb 13, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@scottford-io
Copy link

Is your feature request related to a problem? Please describe.
The following code is valid, but it shows that a single policy can have a conflicting configuration that makes the policy "enabled" "disabled" and "preview"

resource "mondoo_policy_assignment" "enabled_policies" {
  space_id = mondoo_space.os_policy_testing.id

  policies = [
    "//policy.api.mondoo.app/policies/mondoo-gcp-security",
  ]

  state = "enabled" # default is enabled, we also support preview and disabled

  depends_on = [
    mondoo_space.os_policy_testing
  ]
}

resource "mondoo_policy_assignment" "disabled_policies" {
  space_id = mondoo_space.os_policy_testing.id

  policies = [
    "//policy.api.mondoo.app/policies/mondoo-gcp-security",
  ]

  state = "disabled" # default is enabled, we also support preview and disabled

  depends_on = [
    mondoo_space.os_policy_testing
  ]
}

resource "mondoo_policy_assignment" "preview_policies" {
  space_id = mondoo_space.os_policy_testing.id

  policies = [
    "//policy.api.mondoo.app/policies/mondoo-gcp-security",
  ]

  state = "preview" # default is enabled, we also support preview and disabled

  depends_on = [
    mondoo_space.os_policy_testing
  ]
}

Describe the solution you'd like
Is there a way for the API to return an error if multiple resources are trying to manage the state of policy? 🤔

@scottford-io scottford-io added the enhancement New feature or request label Feb 13, 2024
@chris-rock
Copy link
Member

This is something that would need to be checked in terraform, not on the API side.

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

2 participants