Error: Invalid function argument, when using projects variable

Open Beginner friendly
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
terraform

Research direction

Inspect .terraform/modules/openstack/project.tf at line 15 and compare the variable defaults with the README example in main.hcl. Reproduce the error with blockstorage_quota and network_quota omitted; done when the documented projects configuration works without explicitly setting those values and the invalid lookup error no longer occurs.

Written by the indexing model from the issue text.

Description

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 = {}
    }
  }
}
Dominant language
HCL
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More Cloud issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.