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

Produced an unexpected new value... was null.. but now cty.SetValEmpty(cty.String) #176

Closed
5 tasks done
zamanh opened this issue Dec 10, 2024 · 3 comments · Fixed by #177
Closed
5 tasks done

Produced an unexpected new value... was null.. but now cty.SetValEmpty(cty.String) #176

zamanh opened this issue Dec 10, 2024 · 3 comments · Fixed by #177
Assignees
Labels
bug Something isn't working

Comments

@zamanh
Copy link

zamanh commented Dec 10, 2024

Describe the bug

  • Running an apply with the same code again causes the diff to change (I have noticed the diff changes happen for either user or group in a similar way)

Image

and gives error:

Provider produced inconsistent result after apply Error : When applying changes to platform_group.mrgroup, provider produced an unexpected new value: This is a bug in the provider, which should be reported in the provider's own issue tracker. . members: was null, but now cty. SetVa1EmptyCcty. String) .

Code snippet

resource "platform_group" "my-group" {
  name             = "my-group"
  description      = "My group"
  auto_join        = true
  admin_privileges = false
}

resource "artifactory_managed_user" "test-user" {
  name     = "test-user"
  password = "dcfsdcfsdc1sdcsdZ!£"
  email    = "[email protected]"
  groups   = [platform_group.my-group.name]
}

resource "artifactory_local_generic_repository" "test-repo" {
  key          = "test-repo-2"
  description  = "Test repository"
}

resource "artifactory_remote_generic_repository" "test-repo-2-remote" {
  key          = "test-repo-2-remote"
  description  = "Test repository"
  url          = "https://test.com"
}

resource "artifactory_virtual_generic_repository" "test-repo-2-virtual" {
  key          = "test-repo-2-virtual"
  description  = "Test repository"
  repositories = [artifactory_local_generic_repository.test-repo.key, artifactory_remote_generic_repository.test-repo-2-remote.key]
}

resource "platform_permission" "my-permission" {
  name = "my-permission-name"

  artifact = {
    actions = {
      groups = [
        {
          name = platform_group.my-group.name
          permissions = ["READ", "WRITE"]
        }
      ]
    }

    targets = [
      {
        name = artifactory_local_generic_repository.test-repo.key
        include_patterns = ["**"]
      }
    ]
  }
}

Requirements for and issue

  • A description of the bug
  • A fully functioning terraform snippet that can be copy&pasted (no outside files or ENV vars unless that's part of the issue). If this is not supplied, this issue will likely be closed without any effort expended.
  • Your version of artifactory: 7.98.9
  • Your version of terraform: 1.9.8
  • Your version of terraform provider: 1.19.0

Expected behavior

  • Re-running an apply against the same Terraform code shouldn't cause any diff change to either groups or users when the code has not been changed
@zamanh zamanh added the bug Something isn't working label Dec 10, 2024
@zamanh
Copy link
Author

zamanh commented Dec 10, 2024

Another example of the error happening this time on a user (I am using CDKTF in this context, but still reproduced via raw TF)

Image

Produces the same error:
Image

@alexhung
Copy link
Member

@zamanh Thanks for the report! I've added this to our plan to investigate and fix.

@alexhung
Copy link
Member

@zamanh I'll be opening a PR with a fix to this issue shortly. However, I recommend using ignore_changes with platform_group.members attribute to avoid state drift in the first place. Because after the second apply, the user will be removed from the group and now artifactory_user.groups would have different value.

alexhung added a commit that referenced this issue Dec 10, 2024
…with-group

Fix unexpected new value error for platform_group resource
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

Successfully merging a pull request may close this issue.

2 participants