-
-
Notifications
You must be signed in to change notification settings - Fork 959
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
How to use array as input in terragrunt which accepts only as string in terraform #3205
Comments
Hi, for example block:
don't have |
i just gave example snippet of keyvault > terragrunt.hcl file .... i want object id to be in array something like below. { object_id = ["xyz","abc"] , secret_permissions = ["Get","Set"], key_permissions = ["Get"] }, Not multiple object id in different line as in keyvault > terragrunt.hcl file. i tried with set(string) for object id in varaibles.tf file as below , but still issue exist. error - object_id must be string variables.tf: variable "access_policies" { |
Hi,
Reference: |
Hey @Ashraf1991 , did you leverage @denis256 's advice? If so, did it help? |
Hi, |
Using the below code, I was able to achieve the required result, but I have the following error .. any idea?
} terragrunt.hclinputs = { I have not defined TF_VAR_access_policies anywhere in my code.. |
f## Describe the bug
we have terraform code for key vault (Azure) in which object Id is string for access policies . but wanted to give as array i.e multiple user id (object id) in single object id.
Steps To Reproduce
Steps to reproduce the behavior, code snippets and examples which can be used to reproduce the issue.
main.tf :
resource "azurerm_key_vault" "example" {
name = "examplekeyvault"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
enabled_for_disk_encryption = true
tenant_id = data.azurerm_client_config.current.tenant_id
soft_delete_retention_days = 7
purge_protection_enabled = false
sku_name = "standard"
dynamic "access_policy" {
for_each = var.access_policies
content {
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = access_policy.value["object_id"]
secret_permissions = access_policy.value["secret_permissions"]
key_permissions = access_policy.value["key_permissions"]
}
}
variables.tf:
variable "access_policies" {
type = set(
object({
object_id = string,
secret_permissions = set(string),
key_permissions = set(string)
})
)
}
keyvault > terragrunt.hcl :
input ={
access_policies = [
{ object_id = "xyz", secret_permissions = ["Get","Set"], key_permissions = ["Get"] },
{ object_id = "abc", secret_permissions = ["Get"], key_permissions = ["Get"] } ]
above code is working fine
Expected behavior
i want to keep object id as array and secret permission and key permission in 1 line ...somthing like below which is not working even if keep object_id = set(string) in variables.tf
{ object_id = "xyz","abc" , secret_permissions = ["Get","Set"], key_permissions = ["Get"] },
in fact i wanted to keep this object ids as common in global_var.hcl file so that all environment can use have same object_id rather than local terragrunt file.
The text was updated successfully, but these errors were encountered: