Learn what are layer definitions and how they work.
A layer definition is an entry in a JSON object. This entry includes a name, a list of dependencies, and the contents of the Terraform files Layerform will use to spawn infrastructure.
To create a layer definition, you need to start by creating a layerform.json file in the root folder of your project. It’s in that folder that you’ll run layerform configure to provision layers to the back-end.In that file, each object within the layers array contains a layer definition with a name, list of files, and, optionally, a list of dependencies.
name: an unique name for this layer definition. You’ll use this name in the CLI to spawn instances of this layer definition.
files: a list of Terraform files included in this layer. Layerform will run these files to provision infrastructure for an instance of this layer definition.
dependencies: a list layer definition names upon which instances of the current layer will be placed.
Once you have a layerform.json file, you should run layerform configure to upload the layer definitions to your Layerform back-end.
By convention, you should encapsulate your layer definitions’ Terraform files into Terraform modules.Encapsulating layer definitions into modules makes it easier to understand which files belong to each layer.For example, if you have an elastic_stack layer, you’d have kibana.tf and elasticsearch.tf files within a folder called elastic_stack. That folder would also have any necessary inputs and outputs in inputs.tf and outputs.tf files.
Then, when creating the entry in layerform.json, make sure to include both the entrypoint and all the files in the module’s folder.
{ "layers": [ // Don't forget to also add the base layer here { "name": "elastic_stack", "files": ["layers/example.tf", "layers/example/**"], "dependencies": ["base"] } ]}
When using layer definitions, keep in mind that you can reference variables from another definition if, and only if, the reference variable belongs to the layer below.For example, it’s fine if your elastic_stack layer must take an input which comes from the eks module which is part of the underlying eks layer.
module "elastic_stack" { source = "./modules/elastic_stack" # This cluster_id reference comes from a file which # belongs to the underlying `eks` layer. That's fine. cluster_id = modules.eks.cluster_id}
On the other hand, it’s not fine if your eks layer references values from the elastic_stack layer on top of it.
# This code won't workmodule "eks" { source = "./modules/eks" # This is NOT fine! Here, the reference comes from the # elastic_stack layer on *top*. Which won't be available. cluster_id = modules.elastic_stack.elasticsearch_url}
Encapsulating layers into modules makes it easier to understand whether
you’re referencing values in the layers below, above, or next to the target
layer.
Layer definitions are used by the Layerform CLI so it knows which Terraform files to run to create a layer instance. Layerform also looks at the dependencies list to fetch state for any underlying layers.To use a layer definition, you must configure your CLI with the back-end containing the desired definition. For that, you must edit the config.yaml file within ~/.layerform.In that file, you should configure a context with the desired type and its settings. Then, you should set `currentContext to the desired context’s name.
After that, you can spawn layers using layerform spawn <layer_definition_name> <desired_id>. The layerform spawn command will pull the matching definition from the specified context and run its Terraform files.
To update a layer definition, you must update the Terraform files associated with it and run layerform configure again. That will cause the Layerform CLI to update the back-end with your updated files.To delete a particular layer definition, you can simply remove the corresponding entry from your layerform.json file and run layerform configure again.
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Docs","colors":{"primary":"#1E5E46","light":"#89CCAA","dark":"#121212"},"favicon":"/favicon.png","logo":{"light":"https://mintcdn.com/ergomake-83/br_QNJl4feQWyGIg/logo/light.png?fit=max\u0026auto=format\u0026n=br_QNJl4feQWyGIg\u0026q=85\u0026s=8810a4cf7f445e6f94618672fdbaaba0","dark":"https://mintcdn.com/ergomake-83/br_QNJl4feQWyGIg/logo/dark.png?fit=max\u0026auto=format\u0026n=br_QNJl4feQWyGIg\u0026q=85\u0026s=06eeef529ddbf18f851f1c5a1e935f1d"},"appearance":{"default":"light","strict":true},"background":{"image":"https://ergomake.dev/img/gradient.png","decoration":null,"color":{"light":null,"dark":"#121212"}},"navbar":{"links":[{"label":"Support","href":"mailto:layerform@ergomake.dev"}],"primary":{"type":"github","href":"https://github.com/ergomake/layerform"}},"footer":{"socials":{"twitter":"https://twitter.com/GetErgomake","github":"https://github.com/ergomake/layerform","linkedin":"https://www.linkedin.com/company/ergomake","discord":"https://discord.gg/daGzchUGDt"}},"integrations":{"plausible":{"domain":"docs.layerform.dev"}},"navigation":{"global":{"anchors":[{"anchor":"Github","href":"https://github.com/ergomake/layerform","icon":"github"},{"anchor":"Blog","href":"https://layerform.dev/blog","icon":"memo"},{"anchor":"Community","href":"https://discord.gg/daGzchUGDt","icon":"discord"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"ergomake-83","hasAudioNarration":false,"actualSubdomain":"ergomake-83","customDomains":["docs.layerform.dev"],"gitSource":{"type":"github","owner":"ergomake","repo":"layerform-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae91a50abde022f2c1d552a:success","clientVersion":"0.0.4111","searchFilterCounts":[{"language":"default","tag":"Documentation","count":14},{"language":"default","tag":"Reference","count":7},{"language":"default","tag":"Tutorial","count":4},{"language":"default","tag":"Get Started","count":3}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"reference/layer_definitions","slug":"/reference/layer_definitions","pageMetadata":{"title":"Layer definitions","description":"Learn what are layer definitions and how they work.","icon":"layer-group","href":"/reference/layer_definitions"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Learn what are layer definitions and how they work.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,OptimizedImage,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(`div`,{className:`mint-flex mint-justify-center mint-items-center`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/ergomake-83/br_QNJl4feQWyGIg/images/bear-spawn.png?fit=max\u0026auto=format\u0026n=br_QNJl4feQWyGIg\u0026q=85\u0026s=30aaadbc4829fde772439996ee86296d`,width:`384px`,\"data-og-width\":`1640`,\"data-og-height\":`1640`,\"data-path\":`images/bear-spawn.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/ergomake-83/br_QNJl4feQWyGIg/images/bear-spawn.png?w=280\u0026fit=max\u0026auto=format\u0026n=br_QNJl4feQWyGIg\u0026q=85\u0026s=374474192bbf1c1e2c6b89d908d9a429 280w, https://mintcdn.com/ergomake-83/br_QNJl4feQWyGIg/images/bear-spawn.png?w=560\u0026fit=max\u0026auto=format\u0026n=br_QNJl4feQWyGIg\u0026q=85\u0026s=5aee5100fc8af89f81a284577382f5ac 560w, https://mintcdn.com/ergomake-83/br_QNJl4feQWyGIg/images/bear-spawn.png?w=840\u0026fit=max\u0026auto=format\u0026n=br_QNJl4feQWyGIg\u0026q=85\u0026s=80f99d9409336bcedcd8d46568cf06a3 840w, https://mintcdn.com/ergomake-83/br_QNJl4feQWyGIg/images/bear-spawn.png?w=1100\u0026fit=max\u0026auto=format\u0026n=br_QNJl4feQWyGIg\u0026q=85\u0026s=6dbf47a6cdd0fc045e34b664ca333393 1100w, https://mintcdn.com/ergomake-83/br_QNJl4feQWyGIg/images/bear-spawn.png?w=1650\u0026fit=max\u0026auto=format\u0026n=br_QNJl4feQWyGIg\u0026q=85\u0026s=d2276971835ea46bcfb39b1061b198f7 1650w, https://mintcdn.com/ergomake-83/br_QNJl4feQWyGIg/images/bear-spawn.png?w=2500\u0026fit=max\u0026auto=format\u0026n=br_QNJl4feQWyGIg\u0026q=85\u0026s=453b9262a1af663e65ff71a68daedbad 2500w`})}),`\n`,_jsx(_components.p,{children:`A layer definition is an entry in a JSON object. This entry includes a name, a list of dependencies, and the contents of the Terraform files Layerform will use to spawn infrastructure.`}),`\n`,_jsx(Heading,{level:`2`,id:`creating-layer-definitions`,children:`Creating layer definitions`}),`\n`,_jsxs(_components.p,{children:[`To create a layer definition, you need to start by creating a `,_jsx(_components.code,{children:`layerform.json`}),` file in the root folder of your project. It’s in that folder that you’ll run `,_jsx(_components.code,{children:`layerform configure`}),` to provision layers to the back-end.`]}),`\n`,_jsxs(_components.p,{children:[`In that file, each object within the `,_jsx(_components.code,{children:`layers`}),` array contains a layer definition with a name, list of files, and, optionally, a list of dependencies.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`13`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`13`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"layers\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"base_example\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"files\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"layers/base.tf\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"layers/base/**\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"your_top_layer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"files\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"layers/example.tf\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"layers/example/**\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"dependencies\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"base_example\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Here’s what each key is for:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`name`}),`: an unique name for this layer definition. You’ll use this name in the CLI to spawn instances of this layer definition.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`files`}),`: a list of Terraform files included in this layer. Layerform will run these files to provision infrastructure for an instance of this layer definition.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`dependencies`}),`: a list layer definition names upon which instances of the current layer will be placed.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:_jsxs(_components.strong,{children:[`Once you have a `,_jsx(_components.code,{children:`layerform.json`}),` file, you should run `,_jsx(_components.code,{children:`layerform configure`}),` to upload the layer definitions to your Layerform back-end.`]})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.a,{href:`/reference/backends`,children:`See this page to learn more about the multiple Layerform\nback-ends`}),`.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`creating-terraform-files-for-layer-definitions`,children:`Creating Terraform files for layer definitions`}),`\n`,_jsx(_components.p,{children:_jsxs(_components.strong,{children:[`By convention, you should encapsulate your layer definitions’ Terraform files into `,_jsx(_components.a,{href:`https://developer.hashicorp.com/terraform/language/modules`,children:`Terraform modules`}),`.`]})}),`\n`,_jsx(_components.p,{children:`Encapsulating layer definitions into modules makes it easier to understand which files belong to each layer.`}),`\n`,_jsxs(_components.p,{children:[`For example, if you have an `,_jsx(_components.code,{children:`elastic_stack`}),` layer, you’d have `,_jsx(_components.code,{children:`kibana.tf`}),` and `,_jsx(_components.code,{children:`elasticsearch.tf`}),` files within a folder called `,_jsx(_components.code,{children:`elastic_stack`}),`. That folder would also have any necessary inputs and outputs in `,_jsx(_components.code,{children:`inputs.tf`}),` and `,_jsx(_components.code,{children:`outputs.tf`}),` files.`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`7`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`layerform/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`└─ elastic_stack/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ├─ elasticsearch.tf`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ├─ kibana.tf`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ├─ inputs.tf`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` └─ outputs.tf`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Don’t forget to also create an entry-point instantiating your module.`}),`\n`,_jsx(CodeBlock,{numberOfLines:`8`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`layerform/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├─ elastic_stack/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ ├─ elasticsearch.tf`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ ├─ kibana.tf`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ ├─ inputs.tf`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ └─ outputs.tf`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`└─ entrypoint.tf \u003c--- uses the module elastic_stack`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`This entrypoint should instantiate the module and pass the necessary inputs to it.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`hcl`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`hcl`,children:_jsxs(_components.code,{language:`hcl`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`module`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"elastic_stack\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` source`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./modules/elastic_stack\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cluster_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` modules`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`eks`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`cluster_id`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Then, when creating the entry in `,_jsx(_components.code,{children:`layerform.json`}),`, make sure to include both the entrypoint and all the files in the module’s folder.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`jsonc`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`jsonc`,children:_jsxs(_components.code,{language:`jsonc`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"layers\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Don't forget to also add the base layer here`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"elastic_stack\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"files\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"layers/example.tf\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"layers/example/**\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"dependencies\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"base\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`using-variables-across-layer-definitions`,children:`Using variables across layer definitions`}),`\n`,_jsxs(_components.p,{children:[`When using layer definitions, keep in mind that you can reference variables from another definition if, and only if, the reference variable belongs to the layer `,_jsx(_components.em,{children:`below`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`For example, it’s fine if your `,_jsx(_components.code,{children:`elastic_stack`}),` layer must take an `,_jsx(_components.code,{children:`input`}),` which comes from the `,_jsx(_components.code,{children:`eks`}),` module which is part of the underlying `,_jsx(_components.code,{children:`eks`}),` layer.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`hcl`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`hcl`,children:_jsxs(_components.code,{language:`hcl`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`module`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"elastic_stack\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` source`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./modules/elastic_stack\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # This cluster_id reference comes from a file which`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\" # belongs to the underlying `eks` layer. That's fine.\"})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cluster_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` modules`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`eks`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`cluster_id`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`On the other hand, it’s not fine if your `,_jsx(_components.code,{children:`eks`}),` layer references values from the `,_jsx(_components.code,{children:`elastic_stack`}),` layer on top of it.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`hcl`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`hcl`,children:_jsxs(_components.code,{language:`hcl`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# This code won't work`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`module`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"eks\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` source`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./modules/eks\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # This is NOT fine! Here, the reference comes from the`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # elastic_stack layer on *top*. Which won't be available.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cluster_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` modules`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`elastic_stack`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`elasticsearch_url`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Tip,{children:_jsx(_components.p,{children:`Encapsulating layers into modules makes it easier to understand whether\nyou’re referencing values in the layers below, above, or next to the target\nlayer.`})}),`\n`,_jsx(Heading,{level:`2`,id:`using-layer-definitions`,children:`Using layer definitions`}),`\n`,_jsxs(_components.p,{children:[`Layer definitions are used by the Layerform CLI so it knows which Terraform files to run to create a layer instance. Layerform also looks at the `,_jsx(_components.code,{children:`dependencies`}),` list to fetch state for any underlying layers.`]}),`\n`,_jsxs(_components.p,{children:[`To use a layer definition, you must configure your CLI with the back-end containing the desired definition. For that, you must edit the `,_jsx(_components.code,{children:`config.yaml`}),` file within `,_jsx(_components.code,{children:`~/.layerform`}),`.`]}),`\n`,_jsx(_components.p,{children:\"In that file, you should configure a context with the desired type and its settings. Then, you should set `currentContext to the desired context’s name.\"}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`yaml`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`yaml`,children:_jsxs(_components.code,{language:`yaml`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`currentContext`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`tutorial-context`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`contexts`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:` tutorial-context`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:` type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`s3`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:` bucket`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`layerform-bucket-example`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`After that, you can spawn layers using `,_jsx(_components.code,{children:`layerform spawn \u003clayer_definition_name> \u003cdesired_id>`}),`. The `,_jsx(_components.code,{children:`layerform spawn`}),` command will pull the matching definition from the specified context and run its Terraform files.`]}),`\n`,_jsx(Heading,{level:`2`,id:`updating-or-deleting-layer-definitions`,children:`Updating or deleting layer definitions`}),`\n`,_jsxs(_components.p,{children:[`To update a layer definition, you must update the Terraform files associated with it and run `,_jsx(_components.code,{children:`layerform configure`}),` again. That will cause the Layerform CLI to update the back-end with your updated files.`]}),`\n`,_jsxs(_components.p,{children:[`To delete a particular layer definition, you can simply remove the corresponding entry from your `,_jsx(_components.code,{children:`layerform.json`}),` file and run `,_jsx(_components.code,{children:`layerform configure`}),` again.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Layer definitions","description":"Learn what are layer definitions and how they work.","icon":"layer-group","href":"/reference/layer_definitions"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Creating layer definitions","slug":"creating-layer-definitions","depth":2,"children":[{"title":"Creating Terraform files for layer definitions","slug":"creating-terraform-files-for-layer-definitions","depth":3,"children":[]},{"title":"Using variables across layer definitions","slug":"using-variables-across-layer-definitions","depth":3,"children":[]}]},{"title":"Using layer definitions","slug":"using-layer-definitions","depth":2,"children":[]},{"title":"Updating or deleting layer definitions","slug":"updating-or-deleting-layer-definitions","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"dynamicCss":".mint-flex {\n display: flex\n}\n.mint-items-center {\n align-items: center\n}\n.mint-justify-center {\n justify-content: center\n}","subdomain":"ergomake-83","siteName":"Docs","title":"Layer definitions - Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-01-06T23:41:33.637Z","originalFileLocation":"reference/layer_definitions.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"light\";if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Learn what are layer definitions and how they work.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/ergomake-83/lw9sCWG_S3GPUHR7/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/ergomake-83/lw9sCWG_S3GPUHR7/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/ergomake-83/lw9sCWG_S3GPUHR7/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/ergomake-83/lw9sCWG_S3GPUHR7/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/ergomake-83/lw9sCWG_S3GPUHR7/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/ergomake-83/lw9sCWG_S3GPUHR7/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/ergomake-83/lw9sCWG_S3GPUHR7/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/ergomake-83/lw9sCWG_S3GPUHR7/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/ergomake-83/lw9sCWG_S3GPUHR7/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Layer definitions - Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Learn what are layer definitions and how they work.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.layerform.dev/reference/layer_definitions\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://ergomake-83.mintlify.site/_mintlify/api/og/v2?division=Reference\u0026amp;title=Layer+definitions\u0026amp;description=Learn+what+are+layer+definitions+and+how+they+work.\u0026amp;theme=77a0e2a7171e22bf851b1e2a\u0026amp;signature=6e9601cbd0f22762f08dfbc2a48f7a02936c77dff36fbc0e677f27efdd16263e\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Layer definitions - Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Learn what are layer definitions and how they work.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://ergomake-83.mintlify.site/_mintlify/api/og/v2?division=Reference\u0026amp;title=Layer+definitions\u0026amp;description=Learn+what+are+layer+definitions+and+how+they+work.\u0026amp;theme=77a0e2a7171e22bf851b1e2a\u0026amp;signature=6e9601cbd0f22762f08dfbc2a48f7a02936c77dff36fbc0e677f27efdd16263e\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/ergomake-83/lw9sCWG_S3GPUHR7/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#1E5E46\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.layerform.dev/reference/layer_definitions\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/reference/layer_definitions.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.layerform.dev/#organization\",\"name\":\"Docs\",\"url\":\"https://docs.layerform.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/ergomake-83/br_QNJl4feQWyGIg/logo/light.png?fit=max\u0026auto=format\u0026n=br_QNJl4feQWyGIg\u0026q=85\u0026s=8810a4cf7f445e6f94618672fdbaaba0\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.layerform.dev#website\",\"name\":\"Docs\",\"url\":\"https://docs.layerform.dev\",\"publisher\":{\"@id\":\"https://docs.layerform.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.layerform.dev/reference/layer_definitions#webpage\",\"url\":\"https://docs.layerform.dev/reference/layer_definitions\",\"name\":\"Layer definitions\",\"description\":\"Learn what are layer definitions and how they work.\",\"dateModified\":\"2026-01-06T23:41:33.637Z\",\"isPartOf\":{\"@id\":\"https://docs.layerform.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.layerform.dev/reference/layer_definitions#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.layerform.dev/reference/layer_definitions#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Docs\",\"item\":\"https://docs.layerform.dev\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Layer definitions\",\"item\":\"https://docs.layerform.dev/reference/layer_definitions\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.layerform.dev/reference/layer_definitions#article\",\"headline\":\"Layer definitions\",\"name\":\"Layer definitions\",\"description\":\"Learn what are layer definitions and how they work.\",\"url\":\"https://docs.layerform.dev/reference/layer_definitions\",\"mainEntityOfPage\":{\"@id\":\"https://docs.layerform.dev/reference/layer_definitions#webpage\"},\"dateModified\":\"2026-01-06T23:41:33.637Z\",\"publisher\":{\"@id\":\"https://docs.layerform.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.layerform.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Docs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/reference/layer_definitions.md","siteName":"Docs","nav":{"global":{"anchors":[{"anchor":"Github","href":"https://github.com/ergomake/layerform","icon":"github"},{"anchor":"Blog","href":"https://layerform.dev/blog","icon":"memo"},{"anchor":"Community","href":"https://discord.gg/daGzchUGDt","icon":"discord"}]},"anchors":[{"anchor":"Documentation","icon":"book-open","groups":[{"group":"Get Started","pages":[{"title":"Introduction","href":"/introduction"},{"title":"Why layers","href":"/why"},{"title":"Concepts","href":"/concepts"}]},{"group":"Tutorial","pages":[{"title":"Tutorial overview","href":"/tutorial/overview"},{"title":"Creating layer definitions","href":"/tutorial/layer-definitions"},{"title":"Provisioning layer definitions","href":"/tutorial/provisioning"},{"title":"Running the dev infrastructure","description":"Learn how to run the development infrastructure for the Elastic Stack using the layer definitions we've created.","href":"/tutorial/running"}]},{"group":"Reference","pages":[{"title":"Layer definitions","icon":"layer-group","href":"/reference/layer_definitions"},{"title":"Back-ends and provisioning","description":"Learn what is a Layerform back-end and how to use and provision them.","icon":"boxes-packing","href":"/reference/backends"},{"title":"Spawning and killing layers","icon":"square-terminal","href":"/reference/creating_and_deleting"},{"title":"CLI Configs","icon":"sliders","href":"/reference/cli_configs"},{"title":"Listing definitions and instances","icon":"list-check","href":"/reference/managing_layers"},{"title":"Outputs","icon":"file-export","href":"/reference/outputs"},{"title":"Inner workings","icon":"gear","href":"/reference/inner_workings"}]}]}]},"basePath":"","title":"Layer definitions - Docs","buildId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","deploymentId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-DTFzvaXJ.js","lightbox-handle-r17bVUz3.js"]}