Skip to content

Improve import file extension handling #21

@johncblandii

Description

@johncblandii

Have a question? Please checkout our Slack Community or visit our Slack Archive.

Slack Community

Describe the Feature

import:
  - ue1-globals
  - catalog/eks.yaml

Note the incidental .yaml here.

Error:

Error: Error in function call

  on /modules/utils/stack-config.variant line 71:
  (source code not available)

with opt.config-dir as "./stacks",
     opt.stack as "ue1-auto".

Call to function "import" failed: /modules/utils/stack-config.variant:12,13-20: Error in function
call; Call to function "import" failed: /modules/utils/stack-config.variant:10,43-50: Invalid
function argument; Invalid value for "path" parameter: no file exists at
stacks/catalog/eks.yaml.yaml; this function works only with files that are distributed as part of
the configuration source code, so if this file will be created by a resource in this configuration
you must instead obtain this result from an attribute of that resource...

Error: Error in function call

  on /modules/utils/stack-config.variant line 71:
  (source code not available)

with opt.config-dir as "./stacks",
     opt.stack as "ue1-auto".

Call to function "import" failed: /modules/utils/stack-config.variant:12,13-20: Error in function
call; Call to function "import" failed: /modules/utils/stack-config.variant:10,43-50: Invalid
function argument; Invalid value for "path" parameter: no file exists at
stacks/catalog/eks.yaml.yaml; this function works only with files that are distributed as part of
the configuration source code, so if this file will be created by a resource in this configuration
you must instead obtain this result from an attribute of that resource...

Error: 1 error occurred:
        * step "write varfile": job "terraform write varfile": config "config-component": source 0: job "stack config": /modules/utils/stack-config.variant:71,13-20: Error in function call; Call to function "import" failed: /modules/utils/stack-config.variant:12,13-20: Error in function call; Call to function "import" failed: /modules/utils/stack-config.variant:10,43-50: Invalid function argument; Invalid value for "path" parameter: no file exists at stacks/catalog/eks.yaml.yaml; this function works only with files that are distributed as part of the configuration source code, so if this file will be created by a resource in this configuration you must instead obtain this result from an attribute of that resource...

Expected Behavior

A clean error/warning or just allow the extension.

Use Case

It seems reasonable some people may choose to add an extension; ex: yaml vs yml.

Describe Ideal Solution

Allow an extension or default to yaml.

Alternatives Considered

Require no extension, but provide a clean error.

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions