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

Terraform vague error message on length=-1 for random_string resource #26849

Closed
bogdanbarna opened this issue Nov 7, 2020 · 3 comments
Closed
Labels
bug new new issue not yet triaged provider/random

Comments

@bogdanbarna
Copy link

Terraform Version

Terraform v0.13.5
+ provider registry.terraform.io/hashicorp/random v3.0.0

Terraform Configuration Files

variable "name_prefix" {}

resource "random_string" "name_suffix" {
  length  = 30 - length(var.name_prefix)
  upper   = false
  special = false
}

resource "aws_instance" "web" {
  ami           = "ami-07dd19a7900a1f049"
  instance_type = "t3.micro"

  tags = {
    Name = "foo-${random_string.name_suffix.result}"
  }
}

Debug Output

Crash Output

https://gist.github.com/bogdanbarna/4181ddf0b5fe0082e6cdcf4aae8cf0e0

Expected Behavior

A specific error message appearing during plan and/or apply.

Actual Behavior

Receiving Error: rpc error: code = Unavailable desc = transport is closing on apply.

Steps to Reproduce

terraform init
terraform apply -var name_prefix=small # this works
terraform apply -var name_prefix=laaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarge # this crashes

Additional Context

The crash report isn't created when the random_string output is used for the aws_instance input.
So apply -target=random_string creates the crash report, but apply without target does not.

References

@bogdanbarna bogdanbarna added bug new new issue not yet triaged labels Nov 7, 2020
@jbardin
Copy link
Member

jbardin commented Nov 9, 2020

Hi @bogdanbarna

While this will be transferred to the random provider so it can properly validate the inputs, the grpc error output was addressed in #26694.

Thanks!

@ghost
Copy link

ghost commented Nov 9, 2020

This issue has been automatically migrated to hashicorp/terraform-provider-random#129 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to hashicorp/terraform-provider-random#129.

@ghost ghost closed this as completed Nov 9, 2020
@ghost
Copy link

ghost commented Dec 10, 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 as resolved and limited conversation to collaborators Dec 10, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug new new issue not yet triaged provider/random
Projects
None yet
Development

No branches or pull requests

3 participants