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

[New Provider Function]: arn_parse and arn_build #34952

Merged
merged 25 commits into from
Mar 7, 2024
Merged

[New Provider Function]: arn_parse and arn_build #34952

merged 25 commits into from
Mar 7, 2024

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented Dec 15, 2023

Description

The arn_parse and arn_build provider functions will allow practioners to handle ARN (Amazon Resource Name) manipulation with built-in provider functions. The arn_parse function provides similar utility to the aws_arn data source, but with the benefit of running earlier in the execution order.

Relations

References

Output from Acceptance Testing

% TF_ACC_TERRAFORM_PATH=/Users/jaredbaker/go/bin/terraform go test -count=1 -run='^TestARN' -v ./internal/function/
=== RUN   TestARNBuildFunction_known
=== PAUSE TestARNBuildFunction_known
=== RUN   TestARNParseFunction_known
=== PAUSE TestARNParseFunction_known
=== RUN   TestARNParseFunction_invalid
=== PAUSE TestARNParseFunction_invalid
=== CONT  TestARNBuildFunction_known
=== CONT  TestARNParseFunction_invalid
=== CONT  TestARNParseFunction_known
--- PASS: TestARNParseFunction_invalid (1.01s)
--- PASS: TestARNParseFunction_known (9.21s)
--- PASS: TestARNBuildFunction_known (9.25s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/function   12.461s

Copy link

Community Note

Voting for Prioritization

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

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/L Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. provider Pertains to the provider itself, rather than any interaction with AWS. labels Dec 15, 2023
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Dec 15, 2023
The `arn_parse` and `arn_build` provider functions will allow
practioners to easily handle ARN (Amazon Resource Name) manipulation
with built-in functions. The `arn_parse` function provides similar
utility to the `aws_arn` data source, but with the benefit of running
earlier in the execution order.
Copy link

github-actions bot commented Jan 9, 2024

Thank you for your contribution! 🚀

A new usage of AWS SDK for Go V1 was detected. Please prefer AWS SDK for Go V2 for all net-new services. If this is an enhancement or bug fix to an existing AWS SDK Go V1 based resource, this comment can be safely ignored.

For additional information refer to the AWS SDK for Go Versions page in the contributor guide.

@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/meta Issues and PRs that pertain to the meta service. and removed size/L Managed by automation to categorize the size of a PR. labels Jan 9, 2024
mkdocs.yml Show resolved Hide resolved
This fork includes an updated `hashicorp/hcl/v2` dependency to support the provider defined function syntax. Once this update is merged into the upstream repository this commit can be reverted
@jar-b
Copy link
Member Author

jar-b commented Mar 7, 2024

With Terraform 1.8.0-beta1:

% go test -count=1 -v ./internal/function/...

--- PASS: TestARNParseFunction_invalid (0.88s)
--- PASS: TestARNBuildFunction_known (4.91s)
--- PASS: TestARNParseFunction_known (4.91s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/function   9.017s

With Terraform 1.7.X:

% go test -count=1 -v ./internal/function/...

    arn_parse_function_test.go:20: Terraform CLI version 1.7.4 is below minimum version 1.8.0-beta1: skipping test
--- SKIP: TestARNParseFunction_known (0.46s)
=== NAME  TestARNBuildFunction_known
    arn_build_function_test.go:18: Terraform CLI version 1.7.4 is below minimum version 1.8.0-beta1: skipping test
--- SKIP: TestARNBuildFunction_known (0.47s)
=== NAME  TestARNParseFunction_invalid
    arn_parse_function_test.go:40: Terraform CLI version 1.7.4 is below minimum version 1.8.0-beta1: skipping test
--- SKIP: TestARNParseFunction_invalid (0.48s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/function   4.578s

@jar-b jar-b marked this pull request as ready for review March 7, 2024 18:52
@github-actions github-actions bot added linter Pertains to changes to or issues with the various linters. repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. github_actions Pull requests that update Github_actions code labels Mar 7, 2024
@ewbankkit ewbankkit self-assigned this Mar 7, 2024
@ewbankkit
Copy link
Contributor

Not a blocker: We need to add a new-function GitHub label.

Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% go test -count=1 -v ./internal/function/...
=== RUN   TestARNBuildFunction_known
=== PAUSE TestARNBuildFunction_known
=== RUN   TestARNParseFunction_known
=== PAUSE TestARNParseFunction_known
=== RUN   TestARNParseFunction_invalid
=== PAUSE TestARNParseFunction_invalid
=== CONT  TestARNBuildFunction_known
=== CONT  TestARNParseFunction_known
=== CONT  TestARNParseFunction_invalid
    arn_parse_function_test.go:40: Terraform CLI version 1.0.11 is below minimum version 1.8.0-beta1: skipping test
=== NAME  TestARNBuildFunction_known
    arn_build_function_test.go:18: Terraform CLI version 1.0.11 is below minimum version 1.8.0-beta1: skipping test
=== NAME  TestARNParseFunction_known
    arn_parse_function_test.go:20: Terraform CLI version 1.0.11 is below minimum version 1.8.0-beta1: skipping test
--- SKIP: TestARNParseFunction_invalid (0.50s)
--- SKIP: TestARNBuildFunction_known (0.50s)
--- SKIP: TestARNParseFunction_known (0.50s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/function	7.893s
% go test -count=1 -v ./internal/function/...
=== RUN   TestARNBuildFunction_known
=== PAUSE TestARNBuildFunction_known
=== RUN   TestARNParseFunction_known
=== PAUSE TestARNParseFunction_known
=== RUN   TestARNParseFunction_invalid
=== PAUSE TestARNParseFunction_invalid
=== CONT  TestARNBuildFunction_known
=== CONT  TestARNParseFunction_invalid
=== CONT  TestARNParseFunction_known
--- PASS: TestARNParseFunction_invalid (1.70s)
--- PASS: TestARNBuildFunction_known (8.16s)
--- PASS: TestARNParseFunction_known (8.22s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/function	15.317s

@jar-b jar-b merged commit 4c30b74 into main Mar 7, 2024
80 checks passed
@jar-b jar-b deleted the f-arn_parse branch March 7, 2024 21:43
@github-actions github-actions bot added this to the v5.40.0 milestone Mar 7, 2024
github-actions bot pushed a commit that referenced this pull request Mar 7, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Mar 7, 2024
Copy link

github-actions bot commented Mar 7, 2024

This functionality has been released in v5.40.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@jar-b jar-b added the new-function Introduces a new function. label Mar 8, 2024
Copy link

github-actions bot commented Apr 8, 2024

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. github_actions Pull requests that update Github_actions code linter Pertains to changes to or issues with the various linters. new-function Introduces a new function. provider Pertains to the provider itself, rather than any interaction with AWS. repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. service/meta Issues and PRs that pertain to the meta service. size/XL 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.

3 participants