Skip to content

Commit

Permalink
Add example using latest channel as iteration input
Browse files Browse the repository at this point in the history
  • Loading branch information
nywilken committed Jan 27, 2023
1 parent f606862 commit e337fff
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/resources/packer_channel.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ resource "hcp_packer_channel" "staging" {
}
```

Using the latest channel to create a new channel with an assigned iteration.
```terraform
data "hcp_packer_image_iteration" "latest" {
bucket_name = "alpine"
channel = "latest"
}
resource "hcp_packer_channel" "staging" {
name = staging
bucket_name = alpine
assigned_iteration {
id = data.hcp_packer_image_iteration.latest.id
}
}
```


<!-- schema generated by tfplugindocs -->
## Schema

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
data "hcp_packer_image_iteration" "latest" {
bucket_name = "alpine"
channel = "latest"
}

resource "hcp_packer_channel" "staging" {
name = staging
bucket_name = alpine
assigned_iteration {
id = data.hcp_packer_image_iteration.latest.id
}
}
4 changes: 4 additions & 0 deletions templates/resources/packer_channel.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ To create a channel with no assigned iteration.
To create, or update an existing, channel with an assigned iteration.
{{ tffile "examples/resources/hcp_packer_channel/resource_assignment.tf" }}

Using the latest channel to create a new channel with an assigned iteration.
{{ tffile "examples/resources/hcp_packer_channel/resource_using_latest_channel.tf" }}


{{ .SchemaMarkdown | trimspace }}

## Import
Expand Down

0 comments on commit e337fff

Please sign in to comment.