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

hide sensitive values from response_export_values of azapi_resource_action #574

Open
oocx opened this issue Aug 9, 2024 · 1 comment
Open
Labels
enhancement New feature or request upstream-sdk

Comments

@oocx
Copy link

oocx commented Aug 9, 2024

I'm using azapi_resource_action to generate a key pair:

resource "azapi_resource_action" "admin_user_ssh_public_key_generate" {
  type        = "Microsoft.Compute/sshPublicKeys@2022-11-01"
  resource_id = azapi_resource.admin_user_ssh_public_key.id
  action      = "generateKeyPair"
  method      = "POST"

  response_export_values  = ["publicKey", "privateKey"]
  
}

The generated private key is shown in my terraform plan:

-/+ resource "azapi_resource_action" "admin_user_ssh_public_key_generate" {
      ~ id                     = "/subscriptions/.../providers/Microsoft.Compute/sshPublicKeys/mykey/generateKeyPair" -> (known after apply)
      ~ output                 = {
          - privateKey = <<-EOT
                -----BEGIN RSA PRIVATE KEY-----
                ...

How can I mark the privateKey attribute as sensitive, so that it is not shown in the terraform plan?

@ms-henglu ms-henglu added enhancement New feature or request upstream-sdk labels Aug 16, 2024
@ms-henglu
Copy link
Member

Hi @oocx ,

Thank you for taking time to report this issue.

Unfortunately, user couldn't mark a resource's field as sensitive. And from the provider's perspective, the terraform protocol doesn't support marking a field as sensitive conditionally either.

Related issue: hashicorp/terraform-plugin-sdk#736

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request upstream-sdk
Projects
None yet
Development

No branches or pull requests

2 participants