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

Dynamic block for secrets iterates via index not via k/v #1038

Open
6 tasks done
nurkhat-p81 opened this issue Oct 2, 2024 · 0 comments
Open
6 tasks done

Dynamic block for secrets iterates via index not via k/v #1038

nurkhat-p81 opened this issue Oct 2, 2024 · 0 comments
Assignees
Labels
🪲 bug Something isn't working

Comments

@nurkhat-p81
Copy link

Checklist

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

Description

Hi,

I have secrets for action. I use terraform dynamic block to create them. It works. But if I delete one of secrets from listm it will re-index and recreate other secrets.

Expectation

Terraform plan when I comment one of secret with name khan:

# auth0_action.action will be updated in-place
  ~ resource "auth0_action" "action" {
        name       = "test-set-apiBaseUrl12"
        # (4 unchanged attributes hidden)

      - secrets {
          - name  = "khan"
          - value = (sensitive value)
        }

        # (3 unchanged blocks hidden)
    }

Reproduction

I have this tf code for test:

variable "secrets" {
  description = "List of secrets"
  type        = list(map(string))
  default     = [
    {
      name = "solo"
      value = "key-solo"
    },
    {
      name = "khan"
      value = "key-khan"
    },
    {
      name = "yoda"
      value = "key-yoda"
    },
    {
      name = "beko"
      value = "key-beko"
    }
  ]
}


resource "auth0_action" "action" {
    name = "test-set-apiBaseUrl12"
    code = file("./set-apiBaseUrl/code.js")
    runtime = "node18"
    deploy = true
    supported_triggers {
        id      = "post-login"
        version = "v3"
  }

  # Secrets block
  dynamic "secrets" {
    for_each = var.secrets
    content {
      name  = secrets.value.name
      value = secrets.value.value
    }
  }
}

Terraform plan when I comment one of secret with name khan:

# auth0_action.action will be updated in-place
  ~ resource "auth0_action" "action" {
        name       = "test-set-apiBaseUrl12"
        # (4 unchanged attributes hidden)

      ~ secrets {
          ~ name  = "khan" -> "yoda"
          ~ value = (sensitive value)
        }
      ~ secrets {
          ~ name  = "yoda" -> "beko"
          ~ value = (sensitive value)
        }
      - secrets {
          - name  = "beko" -> null
          - value = (sensitive value) -> null
        }

        # (3 unchanged blocks hidden)
    }

Auth0 Terraform Provider version

1.6.1

Terraform version

1.7.5

@nurkhat-p81 nurkhat-p81 added the 🪲 bug Something isn't working label Oct 2, 2024
@ramya18101 ramya18101 self-assigned this Oct 20, 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

2 participants