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

azurerm_api_management_named_value consistently creating "value" resource attribute ignoring state file #6688

Closed
Lidestyle opened this issue Apr 29, 2020 · 3 comments · Fixed by #6834

Comments

@Lidestyle
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

Terraform v0.12.24

  • provider.azurerm v2.7.0

Affected Resource(s)

  • azurerm_api_management_named_value

Terraform Configuration Files

// The local value example:
locals {
    referenced_named_values = merge(
    ... ,
    {
      ## Restriction Named values => Function Application(s) address range
      for i in distinct(flatten(slice(local.helper, 0, 1))) :
      format("function-app-range-%s", index(distinct(flatten(slice(local.helper, 0, 1))), i)) => [i, ["function-app", "whitelist"]]
    },
    ...
    )
}

resource "azurerm_api_management_named_value" "referenced" {
  for_each            = local.referenced_named_values
  resource_group_name = var.resource_group.gateway.name
  api_management_name = azurerm_api_management.apim.name
  name                = each.key
  display_name        = each.key
  value               = element(each.value, 0)
  tags                = element(each.value, 1)
  secret              = local.default_named_value_access_mode // true
}

Expected Behavior

Terraform should update the values for the Azure API Management Named Values in case there are updates.

Actual Behavior

Terraform always create value attribute ignoring state file.

Steps to Reproduce

  1. Set 'secret' attribute to true
  2. terraform apply // Create the resources
  3. terraform apply

Important Factoids

From the resource documentation:

NOTE: setting the field secret to true doesn't make this field sensitive in Terraform, instead it marks the value as secret and encrypts the value in Azure.

References

@Lidestyle Lidestyle changed the title azurerm_api_management_named_value consistently creating value resource attribute ignoring state file azurerm_api_management_named_value consistently creating "value" resource attribute ignoring state file Apr 29, 2020
@yupwei68
Copy link
Contributor

hi @Lidestyle , thanks for opening this issue. When the secret is set true, the service api will not return the value back. Terraform has updated the value field, it just set empty value in value in local state file. We might fix it later.

@ghost
Copy link

ghost commented May 15, 2020

This has been released in version 2.10.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.10.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Jun 12, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Jun 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants