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_mongo_cluster resource does not accept random_password value. #28204

Closed
1 task done
mlognseth-3as opened this issue Dec 6, 2024 · 1 comment · Fixed by #28215
Closed
1 task done

azurerm_mongo_cluster resource does not accept random_password value. #28204

mlognseth-3as opened this issue Dec 6, 2024 · 1 comment · Fixed by #28215

Comments

@mlognseth-3as
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

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 comments along the lines of "+1", "me too" or "any updates", 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 and review the contribution guide to help.

Terraform Version

1.9.8

AzureRM Provider Version

v4.13.0

Affected Resource(s)/Data Source(s)

azurerm_mongo_cluster

Terraform Configuration Files

resource "azurerm_resource_group" "main" {
  name     = "cosmosdb-rg"
  location = "West Europe"
}

resource "random_password" "mongo_admin" {
  override_special = "!$#%"
  length           = 24
  special          = true
  numeric          = true
  upper            = true
  lower            = true
}

resource "azurerm_mongo_cluster" "mongo_cluster" {
  name                   = "cosmosdb-sdm-${var.environment}"
  resource_group_name    = azurerm_resource_group.main.name
  location               = azurerm_resource_group.main.location
  administrator_username = "admin"
  administrator_password = random_password.mongo_admin.result
  shard_count            = 1
  compute_tier           = "M25"
  high_availability_mode = var.high_availability_mode
  storage_size_in_gb     = 32
  version                = "7.0"
}

Debug Output/Panic Output

https://gist.github.com/lgnsth/aaf6a97cd99b4885fe3ca6d16a3202aa

Expected Behaviour

Cluster should be created using the result of random_password as the administrator_password

Actual Behaviour

Create or update fails with:
│ Error: administrator_password is required when create_mode is Default

│ with azurerm_mongo_cluster.mongo_cluster,
│ on mongodb.tf line 10, in resource "azurerm_mongo_cluster" "mongo_cluster":
│ 10: resource "azurerm_mongo_cluster" "mongo_cluster" {

Using a literal string like administrator_password = "hunter2" works fine.
I have attempted several different variants (storing the secret in a KV first and referencing it from there, storing the password result in a local and referencing it, but neither yields different results.)

Steps to Reproduce

Run the provided code using terraform apply

Important Factoids

No

References

No response

@rcskosir
Copy link
Contributor

rcskosir commented Dec 9, 2024

Thank you for taking the time to open this issue. Please subscribe to PR #28215 created by @neil-yechenwei for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants