d/aws_servicecatalog_portfolio: add name argument as an alternative to id - #49278
Open
RajeshRajendiran wants to merge 3 commits into
Open
d/aws_servicecatalog_portfolio: add name argument as an alternative to id#49278RajeshRajendiran wants to merge 3 commits into
RajeshRajendiran wants to merge 3 commits into
Conversation
…o id ListPortfolios has no server-side name filter, so name-based lookup paginates and filters client-side by DisplayName, matching the existing findProductPortfolioAssociations pattern in this package. Errors if more than one portfolio matches the given name.
Contributor
Community GuidelinesThis comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀 Voting for Prioritization
Pull Request Authors
|
Clarify that ListPortfolios does not document ResourceNotFoundException (unlike ListPortfoliosForProduct, which findProductPortfolioAssociations models); the check is kept only for structural consistency with that pattern.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #49258. The
aws_servicecatalog_portfoliodata source requiredidfor lookup, even thoughidis only unique within a single account andname(DisplayName) is what's actually known and referenced in most workflows -- e.g. associating a portfolio with a product or an IAM principal by name. A prior issue requesting this (#20719) was closed without action.ListPortfolioshas no server-side name filter (confirmed against the API model), so thenamelookup path paginates throughListPortfoliosand filters client-side onDisplayName, following the exact same paginate-and-filter pattern already used in this package forfindProductPortfolioAssociationsinfind.go. It errors if more than one portfolio matches the given name (via the existingtfresource.AssertSingleValueResulthelper), sinceDisplayNameisn't guaranteed unique. Once resolved to anid, the rest of the read path (DescribePortfolio) is unchanged.idchanges fromRequiredtoOptional+Computed,namefromComputed-only toOptional+Computed, withExactlyOneOfenforcing exactly one is set.Test plan
go build ./internal/service/servicecatalog/...go vet ./internal/service/servicecatalog/...go test ./internal/service/servicecatalog/...(offline unit tests)TestAccServiceCatalogPortfolioDataSource_name(new, added in this PR) -- not run locally, requires AWS credentials with Service Catalog access