Skip to content

Commit

Permalink
docs: put hcl2 example in first tab
Browse files Browse the repository at this point in the history
  • Loading branch information
mogrogan authored and lbajolet-hashicorp committed Dec 20, 2024
1 parent b6141fd commit 5940ab6
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 188 deletions.
22 changes: 11 additions & 11 deletions website/content/docs/builders/file.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ Below is a fully functioning example. It create a file at `target` with the
specified `content`.

<Tabs>
<Tab heading="JSON">

```json
{
"type": "file",
"content": "Lorem ipsum dolor sit amet",
"target": "dummy_artifact"
}
```

</Tab>
<Tab heading="HCL2">

```hcl
Expand All @@ -49,6 +38,17 @@ build {
}
```

</Tab>
<Tab heading="JSON">

```json
{
"type": "file",
"content": "Lorem ipsum dolor sit amet",
"target": "dummy_artifact"
}
```

</Tab>
</Tabs>

Expand Down
24 changes: 12 additions & 12 deletions website/content/docs/builders/null.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ Below is a fully functioning example. It doesn't do anything useful, since no
provisioners are defined, but it will connect to the specified host via ssh.

<Tabs>
<Tab heading="JSON">

```json
{
"type": "null",
"ssh_host": "127.0.0.1",
"ssh_username": "foo",
"ssh_password": "bar"
}
```

</Tab>
<Tab heading="HCL2">

```hcl
Expand All @@ -52,6 +40,18 @@ build {
}
```

</Tab>
<Tab heading="JSON">

```json
{
"type": "null",
"ssh_host": "127.0.0.1",
"ssh_username": "foo",
"ssh_password": "bar"
}
```

</Tab>
</Tabs>

Expand Down
20 changes: 10 additions & 10 deletions website/content/docs/post-processors/checksum.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ a third-party post-processor.
## Basic example

<Tabs>
<Tab heading="HCL2">

```hcl
post-processor "checksum" {
checksum_types = ["sha1", "sha256"]
output = "packer_{{.BuildName}}_{{.ChecksumType}}.checksum"
}
```

</Tab>
<Tab heading="JSON">

```json
Expand All @@ -43,16 +53,6 @@ a third-party post-processor.
}
```

</Tab>
<Tab heading="HCL2">

```hcl
post-processor "checksum" {
checksum_types = ["sha1", "sha256"]
output = "packer_{{.BuildName}}_{{.ChecksumType}}.checksum"
}
```

</Tab>
</Tabs>

Expand Down
84 changes: 42 additions & 42 deletions website/content/docs/post-processors/manifest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ is not a behavior anyone should ever expect.
The minimal way to use the manifest post-processor is by just writing its definition, like:

<Tabs>
<Tab heading="HCL2">

```hcl
post-processor "manifest" {}
```

</Tab>
<Tab heading="JSON">

```json
Expand All @@ -61,18 +68,24 @@ The minimal way to use the manifest post-processor is by just writing its defini
```

</Tab>
</Tabs>

A more complete example:

<Tabs>
<Tab heading="HCL2">

```hcl
post-processor "manifest" {}
post-processor "manifest" {
output = "manifest.json"
strip_path = true
custom_data = {
my_custom_data = "example"
}
}
```

</Tab>
</Tabs>

A more complete example:

<Tabs>
<Tab heading="JSON">

```json
Expand All @@ -90,19 +103,6 @@ A more complete example:
}
```

</Tab>
<Tab heading="HCL2">

```hcl
post-processor "manifest" {
output = "manifest.json"
strip_path = true
custom_data = {
my_custom_data = "example"
}
}
```

</Tab>
</Tabs>

Expand Down Expand Up @@ -139,6 +139,29 @@ artifacts from the manifest by using `packer_run_uuid`.
The above manifest was generated with the following template:

<Tabs>
<Tab heading="HCL2">

```hcl
source "docker" "docker"{
image = "ubuntu:latest"
export_path = "packer_example"
run_command = ["-d", "-i", "-t", "--entrypoint=/bin/bash", "{{.Image}}"]
}
build {
sources = ["docker.docker"]
post-processor "manifest" {
output = "manifest.json"
strip_path = true
custom_data = {
my_custom_data = "example"
}
}
}
```

</Tab>
<Tab heading="JSON">

```json
Expand All @@ -164,29 +187,6 @@ The above manifest was generated with the following template:
}
```

</Tab>
<Tab heading="HCL2">

```hcl
source "docker" "docker"{
image = "ubuntu:latest"
export_path = "packer_example"
run_command = ["-d", "-i", "-t", "--entrypoint=/bin/bash", "{{.Image}}"]
}
build {
sources = ["docker.docker"]
post-processor "manifest" {
output = "manifest.json"
strip_path = true
custom_data = {
my_custom_data = "example"
}
}
}
```

</Tab>
</Tabs>

Expand Down
48 changes: 24 additions & 24 deletions website/content/docs/provisioners/breakpoint.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,30 @@ and between every provisioner.
## Basic Example

<Tabs>
<Tab heading="HCL2">

```hcl
source "null" "example" {
communicator = "none"
}
build {
sources = ["source.null.example"]
provisioner "shell-local" {
inline = ["echo hi"]
}
provisioner "breakpoint" {
disable = false
note = "this is a breakpoint"
}
provisioner "shell-local" {
inline = ["echo hi 2"]
}
}
```

</Tab>
<Tab heading="JSON">

```json
Expand Down Expand Up @@ -55,30 +79,6 @@ and between every provisioner.
}
```

</Tab>
<Tab heading="HCL2">

```hcl
source "null" "example" {
communicator = "none"
}
build {
sources = ["source.null.example"]
provisioner "shell-local" {
inline = ["echo hi"]
}
provisioner "breakpoint" {
disable = false
note = "this is a breakpoint"
}
provisioner "shell-local" {
inline = ["echo hi 2"]
}
}
```

</Tab>
</Tabs>

Expand Down
20 changes: 10 additions & 10 deletions website/content/docs/provisioners/file.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ The file provisioner can upload both single files and complete directories.
## Basic Example

<Tabs>
<Tab heading="HCL2">

```hcl
provisioner "file" {
source = "app.tar.gz"
destination = "/tmp/app.tar.gz"
}
```

</Tab>
<Tab heading="JSON">

```json
Expand All @@ -40,16 +50,6 @@ The file provisioner can upload both single files and complete directories.
}
```

</Tab>
<Tab heading="HCL2">

```hcl
provisioner "file" {
source = "app.tar.gz"
destination = "/tmp/app.tar.gz"
}
```

</Tab>
</Tabs>

Expand Down
Loading

0 comments on commit 5940ab6

Please sign in to comment.