2020-05-26 09:29:47 -04:00
|
|
|
---
|
|
|
|
description: >
|
2020-06-02 05:49:40 -04:00
|
|
|
A source block nested in a build block allows you to use an already defined
|
2020-05-28 11:04:34 -04:00
|
|
|
source and to set specific fields.
|
2020-05-26 09:29:47 -04:00
|
|
|
layout: docs
|
|
|
|
page_title: source - build - Blocks
|
|
|
|
sidebar_title: <tt>source</tt>
|
|
|
|
---
|
|
|
|
|
|
|
|
# The `source` block
|
|
|
|
|
|
|
|
`@include 'from-1.5/beta-hcl2-note.mdx'`
|
|
|
|
|
2020-05-28 10:22:07 -04:00
|
|
|
A `source` block nested in a `build` block allows to use an already defined
|
|
|
|
source and to set specific fields.
|
2020-05-26 09:29:47 -04:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
# builds.pkr.hcl
|
|
|
|
build {
|
|
|
|
source "amazon-ebs.example" {
|
|
|
|
output = "specific-value"
|
|
|
|
}
|
|
|
|
# ...
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2020-06-02 06:35:32 -04:00
|
|
|
-> **Note:** It is **not allowed** to set the same field in a top-level source
|
|
|
|
block and in a used source block. For example, if in the above example, the
|
|
|
|
top-level "amazon-ebs.example" source block also had an `output` field;
|
|
|
|
Packer would error.
|