diff --git a/x-pack/plugins/fleet/common/services/validate_package_policy.ts b/x-pack/plugins/fleet/common/services/validate_package_policy.ts index 4d54fda6e5df5..3d0e8bed2aafa 100644 --- a/x-pack/plugins/fleet/common/services/validate_package_policy.ts +++ b/x-pack/plugins/fleet/common/services/validate_package_policy.ts @@ -55,6 +55,7 @@ export const validatePackagePolicy = ( description: null, namespace: null, inputs: {}, + vars: {}, }; const namespaceValidation = isValidNamespace(packagePolicy.namespace); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx index 7f67452e2f230..faaf140258dd4 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx @@ -208,9 +208,9 @@ export const StepDefinePackagePolicy: React.FunctionComponent<{ {/* Required vars */} {requiredVars.map((varDef) => { - const { name: varName, type: varType } = varDef; - if (!packagePolicy.vars || !packagePolicy.vars[varName]) return null; - const value = packagePolicy.vars[varName].value; + const { name: varName, type: varType, default: defaultValue } = varDef; + const value = packagePolicy.vars?.[varName]?.value ?? defaultValue; + return (