我正在嘗試在 Terraform 模板中設定一個動態的到期日期。這個想法是獲取當前日期并在該日期上添加 6 個月并將其用作機密的到期日期,但是我正在努力這樣做。
我正在嘗試使用time_offset和timestamp()來實作這一點,但它不起作用,并且出現以下錯誤。
主檔案
resource "time_offset" "expiry_date" {
offset_months = 6
}
resource "azurerm_key_vault_secret" "local_admin_pwd" {
name = "LocalAdminPassword"
value = random_password.pwd.result
key_vault_id = azurerm_key_vault.keyvault.id
expiration_date = timestamp(time_offset.expiry_date.rfc3339)
}
錯誤
│ Error: Too many function arguments
│
│ on key_vault/main.tf line 56, in resource "azurerm_key_vault_secret" "local_admin_pwd":
│ 56: expiration_date = timestamp(time_offset.expiry_date.rfc3339)
│ ├────────────────
│ │ while calling timestamp()
│
│ Function "timestamp" expects only 0 argument(s).
uj5u.com熱心網友回復:
內置timestamp函式不需要任何引數:
函式“timestamp”只需要 0 個引數。
該expiration_date引數應僅從time_offset資源提供的屬性中獲取值:
expiration_date = time_offset.expiry_date.rfc3339
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/528878.html
標籤:天蓝色地形
