Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d/aws_outposts_assets - add host id and status filters #27303

Merged
merged 22 commits into from
Oct 24, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions internal/service/outposts/outpost_assets_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/aws/aws-sdk-go/service/outposts"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
"github.com/hashicorp/terraform-provider-aws/internal/flex"
"github.com/hashicorp/terraform-provider-aws/internal/verify"
)

Expand All @@ -25,6 +26,16 @@ func DataSourceOutpostAssets() *schema.Resource {
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"host_id_filter": {
Type: schema.TypeList,
kpena027 marked this conversation as resolved.
Show resolved Hide resolved
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"status_id_filter": {
Type: schema.TypeList,
kpena027 marked this conversation as resolved.
Show resolved Hide resolved
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
},
}
}
Expand All @@ -36,6 +47,15 @@ func DataSourceOutpostAssetsRead(d *schema.ResourceData, meta interface{}) error
input := &outposts.ListAssetsInput{
OutpostIdentifier: outpost_id,
}

if _, ok := d.GetOk("host_id_filter"); ok {
input.HostIdFilter = flex.ExpandStringList(d.Get("host_id_filter").([]interface{}))
kpena027 marked this conversation as resolved.
Show resolved Hide resolved
}

if _, ok := d.GetOk("status_id_filter"); ok {
input.StatusFilter = flex.ExpandStringList(d.Get("status_id_filter").([]interface{}))
kpena027 marked this conversation as resolved.
Show resolved Hide resolved
}

var asset_ids []string
err := conn.ListAssetsPages(input, func(page *outposts.ListAssetsOutput, lastPage bool) bool {
if page == nil {
Expand Down