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

data-source/aws_lb_listener: Add missing attributes from resource #6830

Merged
merged 3 commits into from
Dec 12, 2018

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Dec 12, 2018

Another pull request in the series to reduce flakey/failing tests before our next major version development.

Previously, the data source would silently fail setting "default_action" attributes.

--- FAIL: TestAccDataSourceAWSLBListener_basic (194.84s)
    testing.go:538: Step 0 error: Check failed: 6 errors occurred:
          * Check 3/14 error: data.aws_lb_listener.front_end: Attribute 'default_action.0.target_group_arn' expected to be set
          * Check 6/14 error: data.aws_lb_listener.front_end: Attribute 'default_action.#' not found
          * Check 7/14 error: data.aws_lb_listener.front_end: Attribute 'default_action.0.type' not found
          * Check 10/14 error: data.aws_lb_listener.from_lb_and_port: Attribute 'default_action.0.target_group_arn' expected to be set
          * Check 13/14 error: data.aws_lb_listener.from_lb_and_port: Attribute 'default_action.#' not found
          * Check 14/14 error: data.aws_lb_listener.from_lb_and_port: Attribute 'default_action.0.type' not found

With error handling enabled in the resource, we now receive proper errors to catch this problem:

--- FAIL: TestAccDataSourceAWSLBListener_basic (173.14s)
    testing.go:538: Step 0 error: Error applying: 2 errors occurred:
          * data.aws_lb_listener.from_lb_and_port: data.aws_lb_listener.from_lb_and_port: error setting default_action: Invalid address to set: []string{"default_action", "0", "order"}
          * data.aws_lb_listener.front_end: data.aws_lb_listener.front_end: error setting default_action: Invalid address to set: []string{"default_action", "0", "order"}

After adding the attributes to the data source and the error handling, all existing acceptance testing is now passing:

--- PASS: TestAccAWSLBListener_oidc (201.60s)
--- PASS: TestAccAWSLBListener_fixedResponse (212.49s)
--- PASS: TestAccAWSLBListener_BackwardsCompatibility (212.58s)
--- PASS: TestAccDataSourceAWSLBListener_basic (213.95s)
--- PASS: TestAccAWSLBListener_redirect (223.34s)
--- PASS: TestAccAWSLBListener_basic (223.43s)
--- PASS: TestAccAWSLBListener_DefaultAction_Order (224.11s)
--- PASS: TestAccDataSourceAWSLBListener_https (225.09s)
--- PASS: TestAccDataSourceAWSLBListener_BackwardsCompatibility (225.14s)
--- PASS: TestAccAWSLBListener_https (235.40s)
--- PASS: TestAccAWSLBListener_cognito (234.78s)
--- PASS: TestAccAWSLBListener_DefaultAction_Order_Recreates (255.74s)

Previously, the data source would silently fail setting "default_action" attributes.

```
--- FAIL: TestAccDataSourceAWSLBListener_basic (194.84s)
    testing.go:538: Step 0 error: Check failed: 6 errors occurred:
        	* Check 3/14 error: data.aws_lb_listener.front_end: Attribute 'default_action.0.target_group_arn' expected to be set
        	* Check 6/14 error: data.aws_lb_listener.front_end: Attribute 'default_action.#' not found
        	* Check 7/14 error: data.aws_lb_listener.front_end: Attribute 'default_action.0.type' not found
        	* Check 10/14 error: data.aws_lb_listener.from_lb_and_port: Attribute 'default_action.0.target_group_arn' expected to be set
        	* Check 13/14 error: data.aws_lb_listener.from_lb_and_port: Attribute 'default_action.#' not found
        	* Check 14/14 error: data.aws_lb_listener.from_lb_and_port: Attribute 'default_action.0.type' not found
```

With error handling enabled in the resource, we now receive proper errors to catch this problem:

```
--- FAIL: TestAccDataSourceAWSLBListener_basic (173.14s)
    testing.go:538: Step 0 error: Error applying: 2 errors occurred:
        	* data.aws_lb_listener.from_lb_and_port: data.aws_lb_listener.from_lb_and_port: error setting default_action: Invalid address to set: []string{"default_action", "0", "order"}
        	* data.aws_lb_listener.front_end: data.aws_lb_listener.front_end: error setting default_action: Invalid address to set: []string{"default_action", "0", "order"}
```

After adding the attributes to the data source and the error handling, all existing acceptance testing is now passing:

```
--- PASS: TestAccAWSLBListener_oidc (201.60s)
--- PASS: TestAccAWSLBListener_fixedResponse (212.49s)
--- PASS: TestAccAWSLBListener_BackwardsCompatibility (212.58s)
--- PASS: TestAccDataSourceAWSLBListener_basic (213.95s)
--- PASS: TestAccAWSLBListener_redirect (223.34s)
--- PASS: TestAccAWSLBListener_basic (223.43s)
--- PASS: TestAccAWSLBListener_DefaultAction_Order (224.11s)
--- PASS: TestAccDataSourceAWSLBListener_https (225.09s)
--- PASS: TestAccDataSourceAWSLBListener_BackwardsCompatibility (225.14s)
--- PASS: TestAccAWSLBListener_https (235.40s)
--- PASS: TestAccAWSLBListener_cognito (234.78s)
--- PASS: TestAccAWSLBListener_DefaultAction_Order_Recreates (255.74s)
```
@bflad bflad requested a review from a team December 12, 2018 18:12
@ghost ghost added size/L Managed by automation to categorize the size of a PR. service/elbv2 Issues and PRs that pertain to the elbv2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Dec 12, 2018
Copy link
Contributor

@paddycarver paddycarver left a comment

Choose a reason for hiding this comment

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

Should you be setting these on read? I should read.

@bflad bflad added the bug Addresses a defect in current functionality. label Dec 12, 2018
@bflad bflad added this to the v1.52.0 milestone Dec 12, 2018
@bflad bflad merged commit cc3a127 into master Dec 12, 2018
@bflad bflad deleted the b-aws_lb_listener-datasource-attributes branch December 12, 2018 19:00
bflad added a commit that referenced this pull request Dec 12, 2018
@bflad
Copy link
Contributor Author

bflad commented Dec 13, 2018

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

@ghost
Copy link

ghost commented Apr 1, 2020

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 and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/elbv2 Issues and PRs that pertain to the elbv2 service. size/L 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.

2 participants