packer-cn/website/pages/docs/from-1.5/blocks/source.mdx

51 lines
1.2 KiB
Plaintext
Raw Normal View History

2020-05-26 09:29:47 -04:00
---
description: >
The top-level source block defines reusable builder configuration blocks
2020-05-26 09:29:47 -04:00
layout: docs
page_title: source - Blocks
sidebar_title: <tt>source</tt>
---
# The `source` block
`@include 'from-1.5/beta-hcl2-note.mdx'`
The top-level `source` block defines reusable builder configuration blocks:
2020-05-26 09:29:47 -04:00
`@include 'from-1.5/sources/example-block.mdx'`
2020-06-02 06:11:55 -04:00
You can start builders by refering to those source blocks form a [`build`
block](/docs/from-1.5/blocks/build), for example :
```hcl
build {
source = [
# Here Packer will use a default ami_name when saving the image.
"sources.amazon-ebs.example",
"sources.amazon-ebs.foo",
]
}
```
The build-level [`source` block](/docs/from-1.5/blocks/build/source) allows to
set specific source fields.
```hcl
build {
source "sources.amazon-ebs.example" {
# Here Packer will use the provided ami_name instead of defaulting it.
ami_name = "specific"
}
}
```
2020-05-26 09:29:47 -04:00
2020-05-28 10:49:54 -04:00
## Related
2020-05-26 09:29:47 -04:00
2020-05-28 10:49:54 -04:00
* The list of available builders can be found in the [builders](/docs/builders)
section.
* A list of [community
2020-06-02 06:01:21 -04:00
builders](/community-tools#community-builders) is available.
2020-05-28 10:49:54 -04:00
* Create your own [custom builder](/docs/extending/custom-builders) !