terraform-provider-auth0 icon indicating copy to clipboard operation
terraform-provider-auth0 copied to clipboard

auth0_client: ommiting the `addons` section will make terraform plan noisy

Open mbelang opened this issue 11 months ago • 3 comments

Checklist

  • [X] I have looked into the README and have not found a suitable solution or answer.
  • [X] I have looked into the documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have upgraded to the latest version of this provider and the issue still persists.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

Description

When creating an auth0_client like this

resource "auth0_client" "this" {
  name        = "Potatoes"
  description = "I love potatoes"
  app_type    = "non_interactive"
}

Doing a plan will result in this which creates noise in the plan section that are missleading user thinking they did something wrong.

 resource "auth0_client" "this" {
        id                                    = "zjpuq6xmRysrxixeB3sTPDfOVTL8tb1N"
        name                                  = "Potatoes"

      - addons {
        }
    }

You can mitigate the problem with the following e.g. adding an empty addons section

resource "auth0_client" "this" {
  name        = "Potatoes"
  description = "I love potatoes"
  app_type    = "non_interactive"
  addons {}
}

Expectation

Planning an auth0_client that doesn't have the addons section specified and has no changes should result in a noop plan.

Reproduction

Create a client like this

resource "auth0_client" "this" {
  name        = "Potatoes"
  description = "I love potatoes"
  app_type    = "non_interactive"
}

Run terraform plan.

Auth0 Terraform Provider version

1.2.0

Terraform version

1.6.x

mbelang avatar Feb 29 '24 21:02 mbelang

Hi @mbelang,

I hope you're having a nice day!

I wanted to express my appreciation for your contribution. Also, I apologize for the late reply.

I've attempted to reproduce the issue using the configuration you provided, but it's not occurring on my end. Could you please provide me with more information or details about the issue?

Thank you.

developerkunal avatar May 28 '24 08:05 developerkunal

I also had this issue with provider version 1.2.0. I didn't attempt to specifically reproduce it, but based on my memory, I think it may have been introduced by hitting "save" in the manage.auth0.com on a non-interactive client. I have a non-interactive client that I created via Terraform (without any auth0_client_credentials resources), and then I used the web UI to upload a private key, and every subsequent run started showing the addons diff until I added the empty block.

Not to hijack the issue, but I wonder if this is related to a broader issue is that the Auth0 API distinguishes between something which is "unset" (and therefore is default) vs. something which has been explicitly set to its default setting. We've just completed a migration of a set of 6-year-old Auth0 environments managed by auth0-deploy-cli to Terraform, and I was running into these all over the place: various "-> null" diffss that would never actually apply, e.g. description, cross_origin_auth, sso, token_dialect, allow_offline_access—so I had to explicitly set defaults all over the place.

emsearcy avatar May 28 '24 17:05 emsearcy

@emsearcy we also experience the same kind of experience you are describing from time to time and our simple solution is to explicitly set the value to the default value. It might be a more generalised problem and we happen to hit it with the addons field on the auth0_client resource

mbelang avatar May 28 '24 20:05 mbelang