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

internal/framework/flex: support set of enum expansion #36789

Merged
merged 1 commit into from Apr 9, 2024

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented Apr 8, 2024

Description

This change enables expansion of sets of string enum types with AutoFlex.

% go test ./internal/framework/flex/... -run=TestExpandSetOfStringEnum
--- FAIL: TestExpandSetOfStringEnum (0.00s)
    --- FAIL: TestExpandSetOfStringEnum/empty_value (0.00s)
panic: reflect.Set: value of type []string is not assignable to type []flex.testEnum [recovered]
        panic: reflect.Set: value of type []string is not assignable to type []flex.testEnum

goroutine 6 [running]:
testing.tRunner.func1.2({0x1014e13a0, 0x140006ba040})
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/testing/testing.go:1631 +0x1c4
testing.tRunner.func1()
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/testing/testing.go:1634 +0x33c
panic({0x1014e13a0?, 0x140006ba040?})
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/runtime/panic.go:770 +0x124
reflect.Value.assignTo({0x1014dca40?, 0x140006c20a8?, 0x18?}, {0x100ffa971, 0xb}, 0x1014daf40, 0x0)
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/reflect/value.go:3356 +0x20c
reflect.Value.Set({0x1014daf40?, 0x1400000ee58?, 0x0?}, {0x1014dca40?, 0x140006c20a8?, 0x2?})
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/reflect/value.go:2325 +0xcc
github.com/hashicorp/terraform-provider-aws/internal/framework/flex.autoExpander.setOfString({}, {0x101587de0, 0x101a3f100}, {{0x101a3f100, 0x0, 0x0}, {0x101589b78, 0x101a3f100}, 0x
2}, {0x1014daf40?, ...})
        /Users/jaredbaker/development/terraform-provider-aws/internal/framework/flex/auto_expand.go:550 +0x4fc
github.com/hashicorp/terraform-provider-aws/internal/framework/flex.autoExpander.set({}, {0x101587de0, 0x101a3f100}, {0x10158be50, 0x14000498b40}, {0x1014daf40?, 0x1400000ee58?, 0x8
ef00?})
        /Users/jaredbaker/development/terraform-provider-aws/internal/framework/flex/auto_expand.go:507 +0x344
github.com/hashicorp/terraform-provider-aws/internal/framework/flex.autoExpander.convert({}, {0x101587de0, 0x101a3f100}, {0x101566840?, 0x14000498b40?, 0x140006b6d08?}, {0x1014daf40
?, 0x1400000ee58?, 0x140006b6e10?})
        /Users/jaredbaker/development/terraform-provider-aws/internal/framework/flex/auto_expand.go:93 +0x49c
github.com/hashicorp/terraform-provider-aws/internal/framework/flex.autoFlexConvert({0x101587de0, 0x101a3f100}, {0x101566840, 0x14000498b40}, {0x1014daf80, 0x1400000ee58}, {0x101583
f88, 0x101a3f100})
        /Users/jaredbaker/development/terraform-provider-aws/internal/framework/flex/autoflex.go:54 +0x214
github.com/hashicorp/terraform-provider-aws/internal/framework/flex.Expand({0x101587de0, 0x101a3f100}, {0x101566840, 0x14000498b40}, {0x1014daf80, 0x1400000ee58}, {0x0, 0x0, 0x14000
05df18?})
        /Users/jaredbaker/development/terraform-provider-aws/internal/framework/flex/auto_expand.go:35 +0xb0
github.com/hashicorp/terraform-provider-aws/internal/framework/flex.runAutoExpandTestCases.func1(0x140000a96c0)
        /Users/jaredbaker/development/terraform-provider-aws/internal/framework/flex/auto_expand_test.go:898 +0x8c
testing.tRunner(0x140000a96c0, 0x140004b52d0)
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/testing/testing.go:1689 +0xec
created by testing.(*T).Run in goroutine 4
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/testing/testing.go:1742 +0x318
FAIL    github.com/hashicorp/terraform-provider-aws/internal/framework/flex     0.303s
FAIL

After:

% go test ./internal/framework/flex/... -run=TestExpandSetOfStringEnum
ok      github.com/hashicorp/terraform-provider-aws/internal/framework/flex     0.480s

Relations

Relates #36557 (Added a similar enhancement for lists, but without tests 🙈 )
Relates #36731 (Fix depends on this)

This change enables expansion of sets of strin enum types with AutoFlex.

```console
% go test ./internal/framework/flex/... -run=TestExpandSetOfStringEnum
--- FAIL: TestExpandSetOfStringEnum (0.00s)
    --- FAIL: TestExpandSetOfStringEnum/empty_value (0.00s)
panic: reflect.Set: value of type []string is not assignable to type []flex.testEnum [recovered]
        panic: reflect.Set: value of type []string is not assignable to type []flex.testEnum

goroutine 6 [running]:
testing.tRunner.func1.2({0x1014e13a0, 0x140006ba040})
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/testing/testing.go:1631 +0x1c4
testing.tRunner.func1()
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/testing/testing.go:1634 +0x33c
panic({0x1014e13a0?, 0x140006ba040?})
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/runtime/panic.go:770 +0x124
reflect.Value.assignTo({0x1014dca40?, 0x140006c20a8?, 0x18?}, {0x100ffa971, 0xb}, 0x1014daf40, 0x0)
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/reflect/value.go:3356 +0x20c
reflect.Value.Set({0x1014daf40?, 0x1400000ee58?, 0x0?}, {0x1014dca40?, 0x140006c20a8?, 0x2?})
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/reflect/value.go:2325 +0xcc
github.com/hashicorp/terraform-provider-aws/internal/framework/flex.autoExpander.setOfString({}, {0x101587de0, 0x101a3f100}, {{0x101a3f100, 0x0, 0x0}, {0x101589b78, 0x101a3f100}, 0x
2}, {0x1014daf40?, ...})
        /Users/jaredbaker/development/terraform-provider-aws/internal/framework/flex/auto_expand.go:550 +0x4fc
github.com/hashicorp/terraform-provider-aws/internal/framework/flex.autoExpander.set({}, {0x101587de0, 0x101a3f100}, {0x10158be50, 0x14000498b40}, {0x1014daf40?, 0x1400000ee58?, 0x8
ef00?})
        /Users/jaredbaker/development/terraform-provider-aws/internal/framework/flex/auto_expand.go:507 +0x344
github.com/hashicorp/terraform-provider-aws/internal/framework/flex.autoExpander.convert({}, {0x101587de0, 0x101a3f100}, {0x101566840?, 0x14000498b40?, 0x140006b6d08?}, {0x1014daf40
?, 0x1400000ee58?, 0x140006b6e10?})
        /Users/jaredbaker/development/terraform-provider-aws/internal/framework/flex/auto_expand.go:93 +0x49c
github.com/hashicorp/terraform-provider-aws/internal/framework/flex.autoFlexConvert({0x101587de0, 0x101a3f100}, {0x101566840, 0x14000498b40}, {0x1014daf80, 0x1400000ee58}, {0x101583
f88, 0x101a3f100})
        /Users/jaredbaker/development/terraform-provider-aws/internal/framework/flex/autoflex.go:54 +0x214
github.com/hashicorp/terraform-provider-aws/internal/framework/flex.Expand({0x101587de0, 0x101a3f100}, {0x101566840, 0x14000498b40}, {0x1014daf80, 0x1400000ee58}, {0x0, 0x0, 0x14000
05df18?})
        /Users/jaredbaker/development/terraform-provider-aws/internal/framework/flex/auto_expand.go:35 +0xb0
github.com/hashicorp/terraform-provider-aws/internal/framework/flex.runAutoExpandTestCases.func1(0x140000a96c0)
        /Users/jaredbaker/development/terraform-provider-aws/internal/framework/flex/auto_expand_test.go:898 +0x8c
testing.tRunner(0x140000a96c0, 0x140004b52d0)
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/testing/testing.go:1689 +0xec
created by testing.(*T).Run in goroutine 4
        /opt/homebrew/Cellar/go/1.22.2/libexec/src/testing/testing.go:1742 +0x318
FAIL    github.com/hashicorp/terraform-provider-aws/internal/framework/flex     0.303s
FAIL
```

After:

```console
% go test ./internal/framework/flex/... -run=TestExpandSetOfStringEnum
ok      github.com/hashicorp/terraform-provider-aws/internal/framework/flex     0.480s
```
Copy link

github-actions bot commented Apr 8, 2024

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/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 8, 2024
@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 Apr 8, 2024
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 🚀.

@jar-b jar-b added the flex Pertains to FLatteners and EXpanders. label Apr 9, 2024
@jar-b jar-b merged commit 501874e into main Apr 9, 2024
102 checks passed
@jar-b jar-b deleted the b-set-of-enum-expander branch April 9, 2024 13:26
@github-actions github-actions bot added this to the v5.45.0 milestone Apr 9, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Apr 11, 2024
Copy link

This functionality has been released in v5.45.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!

Copy link

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 May 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
flex Pertains to FLatteners and EXpanders. size/M 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.

None yet

2 participants