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

🐛 Modifying service account permissions results in ERROR: Provider produced inconsistent result after apply #120

Open
scottford-io opened this issue Jul 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@scottford-io
Copy link

Describe the bug
I created a service account with viewer permissions successfully. After that, I tried to modify the permissions with Terraform to editor and agent. Running terraform apply produces the following error:

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # mondoo_service_account.service_account will be updated in-place
  ~ resource "mondoo_service_account" "service_account" {
        name        = "Service Account Terraform"
      ~ roles       = [
            "//iam.api.mondoo.app/roles/viewer",
          + "//iam.api.mondoo.app/roles/agent",
          + "//iam.api.mondoo.app/roles/editor",
        ]
        # (4 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
mondoo_service_account.service_account: Modifying... [name=Service Account Terraform]
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to mondoo_service_account.service_account, provider "provider[\"registry.terraform.io/mondoohq/mondoo\"]" produced an unexpected new value: .roles: element 1 has vanished.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to mondoo_service_account.service_account, provider "provider[\"registry.terraform.io/mondoohq/mondoo\"]" produced an unexpected new value: .roles: element 2 has vanished.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

To Reproduce
Steps to reproduce the behavior:

  1. Create a service account with Terraform:
resource "mondoo_service_account" "service_account" {
  name        = "Service Account Terraform"
  description = "Service Account for Terraform"
  roles = [
    "//iam.api.mondoo.app/roles/viewer",
  ]
  space_id = mondoo_space.terraform_managed_space.id

  depends_on = [
    mondoo_space.terraform_managed_space
  ]
}
  1. Apply the changes: terraform apply
  2. Modify the permissions of the service account:
resource "mondoo_service_account" "service_account" {
  name        = "Service Account Terraform"
  description = "Service Account for Terraform"
  roles = [
    "//iam.api.mondoo.app/roles/viewer",
    "//iam.api.mondoo.app/roles/agent",
    "//iam.api.mondoo.app/roles/editor",
  ]
  space_id = mondoo_space.terraform_managed_space.id

  depends_on = [
    mondoo_space.terraform_managed_space
  ]
}
  1. Run terraform apply

Expected behavior
Mondoo provider should be able to modify the permissions of a service account.

@scottford-io scottford-io added the bug Something isn't working label Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant