Skip to content

Commit

Permalink
docs: update host set plugin filters examples (#420)
Browse files Browse the repository at this point in the history
This change is to update the example docs for `host_set_plugin` filters attribute to use a list strings instead of just strings.

WIthout using a list of strings, Terraform will falsely detect diffs with host set plugin `filters`.


AWS host set plugin expects filters attributes to be passed as a list of strings instead of strings. It is currently backwards compatible with strings due to the migration [normalizeData func](https://github.com/hashicorp/boundary-plugin-aws/blob/7bf9fe2ecf1f20d7ff8aea8306909abcde1d17a4/plugin/service/host/plugin.go#L256) on AWS host plugin.

Previously this was not working but [Boundary PR-3338](hashicorp/boundary#3338) fixed the bug.
  • Loading branch information
elimt committed Jun 28, 2023
1 parent 1f1bd09 commit b282c05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions docs/resources/host_set_plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,15 @@ resource "boundary_host_catalog_plugin" "aws_example" {
resource "boundary_host_set_plugin" "web" {
name = "My web host set plugin"
host_catalog_id = boundary_host_catalog_plugin.aws_example.id
attributes_json = jsonencode({ "filters" = "tag:service-type=web" })
attributes_json = jsonencode({ "filters" = ["tag:service-type=web"] })
}
resource "boundary_host_set_plugin" "foobar" {
name = "My foobar host set plugin"
host_catalog_id = boundary_host_catalog_plugin.aws_example.id
preferred_endpoints = ["cidr:54.0.0.0/8"]
attributes_json = jsonencode({
"filters" = "tag-key=foo",
"filters" = "tag-key=bar"
"filters" = ["tag-key=foo", "tag-key=bar"]
})
}
Expand All @@ -69,8 +68,7 @@ resource "boundary_host_set_plugin" "launch" {
host_catalog_id = boundary_host_catalog_plugin.aws_example.id
sync_interval_seconds = 60
attributes_json = jsonencode({
"filters" = "tag:development=prod,dev",
"filters" = "launch-time=2022-01-04T*"
"filters" = ["tag:development=prod,dev", "launch-time=2022-01-04T*"]
})
}
Expand Down
8 changes: 3 additions & 5 deletions examples/resources/boundary_host_set_plugin/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ resource "boundary_host_catalog_plugin" "aws_example" {
resource "boundary_host_set_plugin" "web" {
name = "My web host set plugin"
host_catalog_id = boundary_host_catalog_plugin.aws_example.id
attributes_json = jsonencode({ "filters" = "tag:service-type=web" })
attributes_json = jsonencode({ "filters" = ["tag:service-type=web"] })
}

resource "boundary_host_set_plugin" "foobar" {
name = "My foobar host set plugin"
host_catalog_id = boundary_host_catalog_plugin.aws_example.id
preferred_endpoints = ["cidr:54.0.0.0/8"]
attributes_json = jsonencode({
"filters" = "tag-key=foo",
"filters" = "tag-key=bar"
"filters" = ["tag-key=foo", "tag-key=bar"]
})
}

Expand All @@ -54,8 +53,7 @@ resource "boundary_host_set_plugin" "launch" {
host_catalog_id = boundary_host_catalog_plugin.aws_example.id
sync_interval_seconds = 60
attributes_json = jsonencode({
"filters" = "tag:development=prod,dev",
"filters" = "launch-time=2022-01-04T*"
"filters" = ["tag:development=prod,dev", "launch-time=2022-01-04T*"]
})
}

Expand Down

0 comments on commit b282c05

Please sign in to comment.