Skip to content

Error: Invalid function argument, when using projects variable #3

@claudia-lola

Description

@claudia-lola

Have to define blockstorage_quota and network_quota as ={} otherwise get error:

 Error: Invalid function argument                                                                                                               
│                                                                                                                                                
│   on .terraform/modules/openstack/project.tf line 15, in resource "openstack_blockstorage_quotaset_v3" "project":                              
│   15:   volumes              = lookup(each.value.blockstorage_quota, "volumes", null)                                                          
│     ├────────────────                                                                                                                          
│     │ while calling lookup(inputMap, key, default...)                                                                                          
│     │ each.value.blockstorage_quota is null                                                                                                    
│                                                                                                                                                
│ Invalid value for "inputMap" parameter: argument must not be null.   

Config that currently works (based on example in README):

# main.hcl:

module "openstack" {

  # The version here should be changed to the current release:
  source = "github.com/stackhpc/tofu-openstack-config?ref=main"

  projects = {
    test = {
      description = "test project"
      compute_quota = {
        instances = 20
        cores     = 200
        ram       = 512000
      }
      blockstorage_quota = {}
      network_quota = {}
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions