{"record":{"id":"23bbd5cd161e42e7","repo":"hashicorp/packer","slug":"the-input-must-be-specified","errorCode":null,"errorMessage":"The `input` must be specified","messagePattern":"The `input` must be specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"datasource/null/data.go","lineNumber":46,"sourceCode":"\tcommon.PackerConfig `mapstructure:\",squash\"`\n\t// This variable will get stored as \"output\" in the output spec.\n\tInput string `mapstructure:\"input\" required:\"true\"`\n}\n\nfunc (d *Datasource) ConfigSpec() hcldec.ObjectSpec {\n\treturn d.config.FlatMapstructure().HCL2Spec()\n}\n\nfunc (d *Datasource) Configure(raws ...interface{}) error {\n\terr := config.Decode(&d.config, nil, raws...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar errs *packersdk.MultiError\n\n\tif d.config.Input == \"\" {\n\t\terrs = packersdk.MultiErrorAppend(errs, fmt.Errorf(\"The `input` must be specified\"))\n\t}\n\n\tif errs != nil && len(errs.Errors) > 0 {\n\t\treturn errs\n\t}\n\treturn nil\n}\n\ntype DatasourceOutput struct {\n\t// Output will return the input variable, as output.\n\tOutput string `mapstructure:\"output\"`\n}\n\nfunc (d *Datasource) OutputSpec() hcldec.ObjectSpec {\n\treturn (&DatasourceOutput{}).FlatMapstructure().HCL2Spec()\n}\n\nfunc (d *Datasource) Execute() (cty.Value, error) {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/datasource/null/data.go#L28-L64","documentation":"The null datasource simply echoes its `input` back into template data; Configure requires a non-empty `input` string. An empty input is treated as a configuration mistake since the datasource would be useless.","triggerScenarios":"A `data \"null\"` block with no `input` attribute, or input interpolating to an empty string (e.g. an unset variable).","commonSituations":"Template authors using the null datasource as a placeholder and forgetting the input, or a variable defaulting to \"\".","solutions":["Add a non-empty `input` value to the datasource block","Ensure any variable interpolated into `input` has a non-empty default or is provided","Run `packer validate` to catch empty inputs early"],"exampleFix":"// before\ndata \"null\" \"data\" {\n  input = var.maybe_empty\n}\n// after\ndata \"null\" \"data\" {\n  input = coalesce(var.maybe_empty, \"default-value\")\n}","handlingStrategy":"validation","validationCode":"locals { null_input = var.input != \"\" ? var.input : \"default\" }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set `input` explicitly in null datasource blocks","Use variable validation to reject empty strings","Prefer locals over null datasource when no echo is needed"],"tags":["null-datasource","validation","config"],"backgroundTag":"missing-required-argument","analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}