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

resource/aws_lb: suppress diff for attributes incorrect lb types #4032

Merged
merged 1 commit into from
Apr 4, 2018
Merged

resource/aws_lb: suppress diff for attributes incorrect lb types #4032

merged 1 commit into from
Apr 4, 2018

Conversation

appilon
Copy link
Contributor

@appilon appilon commented Apr 3, 2018

Fix #4011

We recently added support for all elbv2 load balancer attributes. Some attributes can only be applied to application load balancers and some only for network load balancers. Even though the code is correct and we would never attempt to set an attribute that didn't apply to a network load balancer (or vice versa), the shared nature of the schema for this resource (and it's defaults) would show values in the state plan even if it did not make sense for the type.

This PR will suppress the diff for the respective attributes and load balancer types. Please let me know if unit tests are required, I have pasted a capture of terraform plan to confirm the attribute are hidden based on type.

network.tf:

resource "aws_lb" "my-lb" {
  name_prefix        = "my-lb"
  load_balancer_type = "network"
}

terraform plan:

Terraform will perform the following actions:

  + aws_lb.my-lb
      id:                               <computed>
      arn:                              <computed>
      arn_suffix:                       <computed>
      dns_name:                         <computed>
      enable_cross_zone_load_balancing: "false"
      enable_deletion_protection:       "false"
      internal:                         <computed>
      ip_address_type:                  <computed>
      load_balancer_type:               "network"
      name:                             <computed>
      name_prefix:                      "my-lb"
      security_groups.#:                <computed>
      subnet_mapping.#:                 <computed>
      subnets.#:                        <computed>
      vpc_id:                           <computed>
      zone_id:                          <computed>

application.tf:

resource "aws_lb" "my-lb" {
  name_prefix        = "my-lb"
  load_balancer_type = "application"
}

terraform plan:

+ aws_lb.my-lb
      id:                         <computed>
      access_logs.#:              <computed>
      arn:                        <computed>
      arn_suffix:                 <computed>
      dns_name:                   <computed>
      enable_deletion_protection: "false"
      enable_http2:               "true"
      idle_timeout:               "60"
      internal:                   <computed>
      ip_address_type:            <computed>
      load_balancer_type:         "application"
      name:                       <computed>
      name_prefix:                "my-lb"
      security_groups.#:          <computed>
      subnet_mapping.#:           <computed>
      subnets.#:                  <computed>
      vpc_id:                     <computed>
      zone_id:                    <computed>

@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Apr 3, 2018
@appilon appilon requested a review from a team April 3, 2018 21:26
@appilon appilon changed the title resoursce/aws_lb: suppress diff for attributes incorrect lb types resource/aws_lb: suppress diff for attributes incorrect lb types Apr 3, 2018
@tpickett66
Copy link

Thanks for jumping on this, I didn't realize that the output I was seeing wouldn't actually get applied since it wasn't applicable for the network type.

@appilon
Copy link
Contributor Author

appilon commented Apr 4, 2018

No worries @tpickett66 thank you for pointing out the erroneous diff, it's very important that the user experience is clear. From your point of view it is very worrisome that the plan appears to be applying attributes that don't make sense for the load balancer type.

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/elbv2 Issues and PRs that pertain to the elbv2 service. labels Apr 4, 2018
@bflad bflad added this to the v1.14.0 milestone Apr 4, 2018
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.

LGTM -- thanks for this!! 🚀

@bflad
Copy link
Contributor

bflad commented Apr 6, 2018

This has been released in version 1.14.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 6, 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 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/elbv2 Issues and PRs that pertain to the elbv2 service. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_lb resource enable_http2 for network type load balancer doesn't make sense (and is invalid)
3 participants