auth0 / auth0-cli

Build, manage and test your Auth0 integrations from the command line
https://auth0.github.io/auth0-cli/
MIT License
249 stars 52 forks source link

`auth0 terraform generate` should use `null` instead of `{}` for empty `encryption_key` property of `auth0_client` resources #1001

Open bugfloyd opened 4 months ago

bugfloyd commented 4 months ago

Checklist

Description

When generating Terraform configuration from an existing tenant using auth0 terraform generate, if a client application lacks an encryption_key, the generated code sets the value to {}. This prevents deployment, causing the following error:

│ Error: 400 Bad Request: Payload validation error: 'Too few properties defined (0), minimum 1' on property encryption_key (Encryption used for WsFed responses with this client).
│ 
│   with auth0_client.example_app,
│   on clients.tf line 1, in resource "auth0_client" "example_app":
│    1: resource "auth0_client" "example_app" {

Expectation

I expect to be able to plan and apply the generated Terraform resources on an empty tenant. However, the above error is blocking this process. A potential workaround is to use null for the encryption_key property instead of {} when it is empty for an application.

Reproduction

  1. Create a sample application using the Auth0 console with the bare minimum information.
  2. Use the CLI to generate Terraform configuration for that application.
  3. Attempt to deploy the generated resource by running terraform plan.

Auth0 CLI version

1.4.0