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_prefix_list: add support for managed prefix lists #14110

Conversation

roberth-k
Copy link
Contributor

@roberth-k roberth-k commented Jul 9, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates #14068, #14109 (both must be merged before this change), #13986

Ignore changes related to the aws_prefix_list and aws_prefix_list_entry resources: code from #14068 are necessary in order to be able to test changes to the data source.

As stated in the discussion of #14068:

The DescribeManagedPrefixLists API is a superset of DescribePrefixLists, even returning AWS's own prefix lists by default. A separate aws_prefix_list resource would have to artificially insert a filter by owner-id in order to produce only customer-managed prefix lists. It seemed appropriate to present an unambiguous data source, though I did at one point consider aliasing the two names.

However, I'm happy to expose managed prefix lists as a separate data source if that's the maintainers' preference.

Release note for CHANGELOG:

ENHANCEMENTS:
- data-source/aws_prefix_list: Support querying managed prefix lists
- data-source/aws_prefix_list: Add `owner_id`, `address_family`, `arn`, `max_entries`, `tags` attributes

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS=-run=TestA
ccDataSourceAwsPrefixList_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccDataSourceAwsPrefixList_ -timeout 120m
--- PASS: TestAccDataSourceAwsPrefixList_nameDoesNotOverrideFilter (4.55s)
--- PASS: TestAccDataSourceAwsPrefixList_matchesTooMany (4.55s)
--- PASS: TestAccDataSourceAwsPrefixList_filter (23.59s)
--- PASS: TestAccDataSourceAwsPrefixList_basic (23.61s)
--- PASS: TestAccDataSourceAwsPrefixList_managedPrefixList (32.93s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       34.474s

@roberth-k roberth-k requested a review from a team July 9, 2020 10:54
@ghost ghost added size/XXL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. needs-triage Waiting for first response or review from a maintainer. provider Pertains to the provider itself, rather than any interaction with AWS. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jul 9, 2020
@roberth-k roberth-k force-pushed the f-aws_prefix_list-data-source-managed-prefix-list branch from 3812bf6 to 07f0e09 Compare July 21, 2020 21:49
@roberth-k roberth-k force-pushed the f-aws_prefix_list-data-source-managed-prefix-list branch from 07f0e09 to ccd00bf Compare July 21, 2020 21:51
@teamterraform
Copy link

Notification of Recent and Upcoming Changes to Contributions

Thank you for this contribution! There have been a few recent development changes that affect this pull request. We apologize for the inconvenience, especially if there have been long review delays up until now. Please note that this is automated message from an unmonitored account. See the FAQ for additional information on the maintainer team and review prioritization.

If you are unable to complete these updates, please leave a comment for the community and maintainers so someone can potentially continue the work. The maintainers will encourage other contributors to use the existing contribution as the base for additional changes as appropriate. Otherwise, contributions that do not receive updated code or comments from the original contributor may be closed in the future so the maintainers can focus on active items.

For the most up to date information about Terraform AWS Provider development, see the Contributing Guide. Additional technical debt changes can be tracked with the technical-debt label on issues.

As part of updating a pull request with these changes, the most current unit testing and linting will run. These may report issues that were not previously reported.

Terraform 0.12 Syntax

Reference: #8950
Reference: #14417

Version 3 and later of the Terraform AWS Provider, which all existing contributions would potentially be added, only supports Terraform 0.12 and later. Certain syntax elements of Terraform 0.11 and earlier show deprecation warnings during runs with Terraform 0.12. Documentation and test configurations, such as those including deprecated string interpolations (some_attribute = "${aws_service_thing.example.id}") should be updated to the newer syntax (some_attribute = aws_service_thing.example.id). Contribution testing will automatically fail on older syntax in the near future. Please see the referenced issues for additional information.

Action Required: Terraform Plugin SDK Version 2

Reference: #14551

The Terraform AWS Provider has been upgraded to the latest version of the Terraform Plugin SDK. Generally, most changes to contributions should only involve updating Go import paths in source code files. Please see the referenced issue for additional information.

Removal of website/aws.erb File

Reference: #14712

Any changes to the website/aws.erb file are no longer necessary and should be removed from this contribution to prevent merge issues in the near future when the file is removed from the repository. Please see the referenced issue for additional information.

Upcoming Change of Git Branch Naming

Reference: #14292

Development environments will need their upstream Git branch updated from master to main in the near future. Please see the referenced issue for additional information and scheduling.

Upcoming Change of GitHub Organization

Reference: #14715

This repository will be migrating from https://github.com/terraform-providers/terraform-provider-aws to https://github.com/hashicorp/terraform-provider-aws. No practitioner or developer action is anticipated and most GitHub functionality will automatically redirect to the new location. Go import paths including terraform-providers can remain for now. Please see the referenced issue for additional information and scheduling.

@robcoward
Copy link

Any chance of getting this merged and released ?

@lmmattr
Copy link

lmmattr commented Oct 27, 2020

@roberth-k Do you know when this will be merged? Would love to have this in.

@ewbankkit
Copy link
Contributor

@lmmattr Support for Managed Prefix Lists is on the roadmap for the upcoming quarter.

@bflad bflad self-assigned this Dec 3, 2020
@bflad bflad added breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 3, 2020
@bflad
Copy link
Contributor

bflad commented Dec 3, 2020

(Note: breaking change label applied due to containing commits from other pull request: #14109 (review) -- will remove the label when those feedback items are also addressed in this pull request)

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @roberth-k 👋 Thank you again for all the work so far. 😄 It felt important to drop this first comment in since it might be easiest to submit a net-new PR without the baggage of the prior commits. I can review that implementation immediately if/when its available. 👍


filters, filtersOk := d.GetOk("filter")

req := &ec2.DescribePrefixListsInput{}
req := &ec2.DescribeManagedPrefixListsInput{}
Copy link
Contributor

@bflad bflad Dec 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a very forward comment here since it will dramatically change the implementation -- rather than change the API call associated with the existing data source, which can cause issues in environments that utilize restrictive IAM permissions or with AWS "compatible" APIs that may not support the new API call, the preference would be to create a separate data source so operators can choose the appropriate solution. 👍

It may be easiest to close this pull request and separately submit a pull request with just a new aws_ec2_managed_prefix_list data source that for now just tests AWS managed prefix lists. Once #14068 is merged, we can add any remaining functionality to the new data source.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bflad,

may not support the new API call,

I hadn't considered this detail, and it makes the right course clear in retrospect. Indeed, the managed prefix list API-s require a different set of IAM actions.

Just to confirm, is aws_ec2_managed_prefix_list (as well as aws_ec2_managed_prefix_list_entry in the resource PR) the preferred nomenclature?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please, and thank you regarding the naming! We can separately discuss the merits of an _entry resource in the other pull request.

@roberth-k
Copy link
Contributor Author

@bflad Superseded by #16738.

@roberth-k roberth-k closed this Dec 13, 2020
@ghost
Copy link

ghost commented Jan 12, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Jan 12, 2021
@roberth-k roberth-k deleted the f-aws_prefix_list-data-source-managed-prefix-list branch January 16, 2022 20:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. provider Pertains to the provider itself, rather than any interaction with AWS. service/ec2 Issues and PRs that pertain to the ec2 service. size/XXL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants