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

prismacloud_account_group and prismacloud_account interfere #115

Open
davemac30 opened this issue Feb 9, 2022 · 2 comments
Open

prismacloud_account_group and prismacloud_account interfere #115

davemac30 opened this issue Feb 9, 2022 · 2 comments
Labels

Comments

@davemac30
Copy link

Describe the bug

We're using prisma_cloudaccount to add AWS accounts to Prisma in a terraform-managed account group. On a subsequent run of the config with the prismacloud_account_group resource, the accounts are removed from the account group even though we are not specifying account_ids on the prismacloud_account_group.

Expected behavior

If account_ids in the prismacloud_account_group resource is not specified, then the value should be computed.

Current behavior

Not specifying account_ids in the prismacloud_account_group causes all accounts to be removed from the group.

Possible solution

Should be a fairly easy fix - just set Computed: true in the schema for account_ids in resource_account_group.go. I'll test and PR.

@davemac30 davemac30 added the bug label Feb 9, 2022
@welcome-to-palo-alto-networks
Copy link

🎉 Thanks for opening your first issue here! Welcome to the community!

davemac30 added a commit to davemac30/terraform-provider-prismacloud that referenced this issue Feb 9, 2022
If not specified, the `account_ids` attribute of the
`prismacloud_account_group` should be computed, otherwise any existing
accounts are removed from the group.

fix PaloAltoNetworks#115
@gilles-o
Copy link

gilles-o commented Mar 3, 2023

Hello there,

We've been hitting the same since quite some time...

Just sharing the below workaround that uses a lifecycle statement:

resource "prismacloud_account_group" "these" {
  lifecycle {
    ignore_changes = [
      account_ids
    ]
  }

  for_each    = { for group in var.my_llist : group.name => group }
  name        = each.value.name
  description = "${each.value.description} - Terraformed"
}

Maybe this can be added to the documentation?
Or best is to implement @davemac30 's solution, since it's mandatory to provide group-ids for a cloud-account resource.

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

Successfully merging a pull request may close this issue.

2 participants