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

Bug: Prevent empty string to be used as default health_check_type #1052

Merged
merged 1 commit into from
Feb 27, 2015

Conversation

radeksimko
Copy link
Member

I guess this bug has been introduced along with swapping the AWS libraries.

If you run following sample template:

provider "aws" {
  region = "eu-west-1"
}

resource "aws_launch_configuration" "foo" {
  name = "sample"
  image_id = "ami-8f0087f8"
  instance_type = "t1.micro"
}

resource "aws_autoscaling_group" "bar" {
  availability_zones = ["eu-west-1a"]
  name = "sample"
  max_size = 5
  min_size = 2

  launch_configuration = "${aws_launch_configuration.foo.name}"
}

you'll see following error:

Error creating Autoscaling Group: 1 validation error detected: Value '' at 'healthCheckType' failed to satisfy constraint: Member must have length greater than or equal to 1

The proposed change will only pass health_check_type to the underlying library if it's actually defined.

cc @catsby

@@ -138,6 +137,10 @@ func resourceAwsAutoscalingGroupCreate(d *schema.ResourceData, meta interface{})
autoScalingGroupOpts.DefaultCooldown = aws.Integer(v.(int))
}

if d.HasChange("health_check") {
autoScalingGroupOpts.HealthCheckType = aws.String(d.Get("health_check_type").(string))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be a GetOk and the check should be ok && v.(string) != ""

Copy link
Member Author

Choose a reason for hiding this comment

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

ah, right, I see, I will change it then.

@radeksimko
Copy link
Member Author

Fixed the check as requested.

@pearkes
Copy link
Contributor

pearkes commented Feb 27, 2015

Thanks!

pearkes added a commit that referenced this pull request Feb 27, 2015
Bug: Prevent empty string to be used as default health_check_type
@pearkes pearkes merged commit 053a7c0 into hashicorp:master Feb 27, 2015
@radeksimko radeksimko deleted the hct-bugfix branch February 27, 2015 18:37
@ghost
Copy link

ghost commented May 4, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators May 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants