azurenoops / ref-scca-enclave-landing-zone-starter

A reference implementation of an SCCA-compliant Mission Enclave landing zone that supports running Azure PaaS services using Azure NoOps.
4 stars 7 forks source link

04-roles/outputs.tf fails due to Invalid Index errors when deploy_custom_roles is false #11

Closed timothymeyers closed 1 year ago

timothymeyers commented 1 year ago

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Running terraform plan results in two Invalid index errors as a result of setting deploy_custom_roles=false in parameters.tfvars

Any log messages given by the failure

image

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful

Same fix as #10; use length().

output "role_definition_ids" {
  value       = length(module.mod_custom_roles) > 0 ? module.mod_custom_roles[0].role_definition_ids : null
  description = "List of Role Definition IDs."
}

output "role_definition_resource_ids" {
  value       = length(module.mod_custom_roles) > 0 ? module.mod_custom_roles[0].role_definition_resource_ids : null
  description = "List of Azure Resource Manager IDs for the resources."
}

Thanks! We'll be in touch soon.