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

Ambiguous error while creating asg with launch config #18262

Closed
arshdeeptinna opened this issue Jun 15, 2018 · 3 comments
Closed

Ambiguous error while creating asg with launch config #18262

arshdeeptinna opened this issue Jun 15, 2018 · 3 comments

Comments

@arshdeeptinna
Copy link

I have following as part of config in a module to setup an asg. I noticed weird behavior where when i did terraform plan, terraform complained about not being able to find resource names aws_launch_configuration.this. I had already used the module before so this error was unexpected.

To test a theory I removed launch_configuration variable from aws_autoscaling_group resource and re-ran terraform plan. Plan failed again but this time telling me the real problem which was that my user_data length was greater than 16384.

Terraform Version

0.11.5

Terraform Configuration Files

resource "aws_launch_configuration" "this" {
  name_prefix = "${var.cluster}-${var.environment}"
  image_id = "${var.ami_id}"
  instance_type = "${var.instance_type}"
  security_groups = ["${concat(list(aws_security_group.this.id), var.additional_security_groups)}"]
  associate_public_ip_address = false
  iam_instance_profile = "${aws_iam_instance_profile.kafka.id}"
  user_data = "${var.user_data}"
  key_name = "${var.key_pair}"
  ebs_optimized = true

}
resource "aws_autoscaling_group" "this" {
  name = "${aws_launch_configuration.kafka.name}-asg"
  max_size = "${var.max_instance_count}"
  min_size = "${var.min_instance_count}"
  desired_capacity = "${var.desired_instance_count}"
  force_delete = true
  launch_configuration = "${aws_launch_configuration.this.id}"
  tags = "${var.tags}"


 }


Debug Output

Crash Output

Expected Behavior

If it fails planning launch config resource, it should through a relevant error like
Should module.asg.aws_launch_configuration.this: expected length of user_data to be in the range (1 - 16384), got #! /bin/bash

Actual Behavior

resource 'aws_autoscaling_group.this' config: unknown resource 'aws_launch_configuration.this' referenced in variable aws_launch_configuration.this.id

Steps to Reproduce

Use a simple module to create a launch config and asg
Create a userdata script with length greater than 16384
terraform init
terraform plan

Additional Context

References

@bflad
Copy link
Contributor

bflad commented Jun 15, 2018

Potentially similar to #18129?

@apparentlymart
Copy link
Contributor

Hi @arshdeeptinna! Sorry for the slow response here.

I believe @bflad is correct that this is the same root cause as #18129. I've added that to the v0.12.0 milestone to be addressed before we get to final, and I'm going to close this one just to consolidate the discussion over there.

Thanks for reporting this!

@ghost
Copy link

ghost commented Mar 31, 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 Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants