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

Fail during plan if user_data on aws_instance is > 16KB #5525

Closed
l2ol33rt opened this issue Mar 9, 2016 · 5 comments
Closed

Fail during plan if user_data on aws_instance is > 16KB #5525

l2ol33rt opened this issue Mar 9, 2016 · 5 comments

Comments

@l2ol33rt
Copy link

l2ol33rt commented Mar 9, 2016

From the AWS docs:

User data is limited to 16 KB. This limit applies to the data in raw form, not
base64-encoded form.

When user-data is >16 KB the output of terraform apply only notifies the user that the state was not applied due to timeout:

Error applying plan:

1 error(s) occurred:

* aws_launch_configuration.main: Error creating launch configuration: timeout while waiting for state to become '[success]'

Setting TF_LOG=DEBUG didn't seem to help in this situation. But taking the size of the file <16 KB fixes the issue, but it took some digging to realize what was going on initially.

I would think an error should be triggered during terraform plan when user-data exceeds 16 KB. Let me know what you think!

Terraform version: v0.6.11

@stack72
Copy link
Contributor

stack72 commented Mar 9, 2016

Hi @l2ol33rt,

There are actually 2 issues here:

  1. The timeout issue
    This has actually been fixed in master and was due to a bug in resource.Retry
  2. The size of user_data
    This is the issue we need to fix up :)

I will have a look and see if i can reproduce this

@jen20
Copy link
Contributor

jen20 commented Mar 9, 2016

Hi @l2ol33rt! As @stack72 correctly identifies, the error message here is part of a wider group of issues which is being tracked by a meta-issue over at #5537.

We should indeed report an error at the plan phase if possible about the size of the user data however. This is not always possible as the value could be computed based on arbitrary length values in a template, but we can detect the "obvious" case of a static value which is more than 16 kilobytes and deal with that at the planning phase, falling back on the fixed up API error behaviour if this is not possible. I've updated the title of this issue accordingly. Thanks for reporting!

@jen20 jen20 changed the title Error verbosity when user-data size >16 KB for provider.aws Fail during plan if user_data on aws_instance is > 16KB Mar 9, 2016
@l2ol33rt
Copy link
Author

l2ol33rt commented Mar 9, 2016

@stack72 @jen20 I really appreciate all the feedback regarding this!

I went ahead and built terraform off master and confirmed that this does resolve the timeout error and reveal a more helpful ValidationError see below:

* aws_launch_configuration.main: Error creating launch configuration:
ValidationError: 1 validation error detected: Value 'I2Nsb3VkLnNvbm
ZpZwphcHRfc291cmNlczoKIC...' at 'userData' failed to satisfy
constraint: Member must have length less than or equal to 21847
status code: 400, request id: 39a...

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

This is much more helpful since it appears to have displayed the API error. @jen20 adding detection when user-data's static value >16KB during the plan phase would be awesome!

Terraform v0.6.13-dev (8d051ef268d129019299c2f495de2a9dbb51c254)

@stack72
Copy link
Contributor

stack72 commented Mar 9, 2016

👍

@ghost
Copy link

ghost commented Apr 11, 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 Apr 11, 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

4 participants