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

aws_globalaccelerator_endpoint_group traffic_dial_percentage cannot be set to 0 #11182

Closed
maleko66 opened this issue Dec 6, 2019 · 4 comments · Fixed by #11253
Closed

aws_globalaccelerator_endpoint_group traffic_dial_percentage cannot be set to 0 #11182

maleko66 opened this issue Dec 6, 2019 · 4 comments · Fixed by #11253
Labels
bug Addresses a defect in current functionality. service/globalaccelerator Issues and PRs that pertain to the globalaccelerator service.
Milestone

Comments

@maleko66
Copy link

maleko66 commented Dec 6, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.12.8

  • provider.aws v2.41.0

Affected Resource(s)

  • aws_globalaccelerator_endpoint_group

Terraform Configuration Files

resource "aws_globalaccelerator_endpoint_group" "eu-west-1" {
  listener_arn            = aws_globalaccelerator_listener.some.id
  health_check_path       = ""
  health_check_port       = 443
  traffic_dial_percentage = 0
  endpoint_group_region   = "eu-west-1"

  endpoint_configuration {
    endpoint_id = "arn:some-alb-in-eu-west-1"
    weight      = 128
  }
}

Expected Behavior

New endpoint with traffic dial set to 0%

Actual Behavior

0% is ignored and new endpoint has traffic dial set to 100% (100% is the default). In fact, 0% is always ignored. You can't change any existing traffic_dial_percentage to 0% as this results in a no-op with subsequent terraform plan and terraform apply still wanting to change the value to 0%.

Steps to Reproduce

  1. terraform apply
@ghost ghost added the service/globalaccelerator Issues and PRs that pertain to the globalaccelerator service. label Dec 6, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 6, 2019
@bflad bflad added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 6, 2019
@bflad
Copy link
Contributor

bflad commented Dec 6, 2019

Ah, thanks for reporting this @maleko66 👍 Indeed the logic in the resource would currently prevent the configuration of the value 0, because its currently using d.GetOk("traffic_dial_percentage"), which will return false if the value is 0 (matching the type's zero-value).

If you or anyone else is interesting in fixing this, we need to use d.Get("traffic_dial_percentage").(float64) instead, which is safe because the attribute always has a value due to the Default: 100.0. e.g.

	opts := &globalaccelerator.CreateEndpointGroupInput{
		ListenerArn:           aws.String(d.Get("listener_arn").(string)),
		IdempotencyToken:      aws.String(resource.UniqueId()),
		EndpointGroupRegion:   aws.String(region),
		TrafficDialPercentage: aws.Float64(d.Get("traffic_dial_percentage").(float64)),
	}
// ...
	opts := &globalaccelerator.UpdateEndpointGroupInput{
		EndpointGroupArn:      aws.String(d.Id()),
		TrafficDialPercentage: aws.Float64(d.Get("traffic_dial_percentage").(float64)),
	}

And removing the d.GetOk("traffic_dial_percentage") calls. 👍

bflad added a commit that referenced this issue Dec 18, 2019
…ting for traffic_dial_percentage = 0

Reference: #11182

Output from acceptance testing:

```
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_basic (162.47s)
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_update (200.66s)
```
@bflad bflad added this to the v2.43.0 milestone Dec 18, 2019
@bflad
Copy link
Contributor

bflad commented Dec 18, 2019

The fix for this has been merged and will release with version 2.43.0 of the Terraform AWS Provider, tomorrow. Thanks to @zsiddique for the implementation 👍

@ghost
Copy link

ghost commented Dec 19, 2019

This has been released in version 2.43.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 for triage. Thanks!

@ghost
Copy link

ghost commented Jan 17, 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 Jan 17, 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/globalaccelerator Issues and PRs that pertain to the globalaccelerator service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants