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

31 lines
762 B
Plaintext
Raw Normal View History

2020-05-26 09:29:47 -04:00
---
description: >
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.