terraform-provider-random icon indicating copy to clipboard operation
terraform-provider-random copied to clipboard

`random_pet` separator attribute must be specified if using Terraform 0.12.0-beta1

Open errygg opened this issue 6 years ago • 1 comments

Terraform Version

Terraform v0.12.0-beta1

Affected Resource(s)

random_pet

Terraform Configuration Files

variable "whose" {
  description = "Who's animal this is"
  type        = string
  default     = null
}

variable "yours_length" {
  description = "Length in words that your pet's name should be"
  type        = string
  default     = "3"
}

variable "mine_length" {
  description = "Length in words that my pet's name should be"
  type        = string
  default     = "2"
}

resource "random_pet" "pet" {

  length = (var.whose == "yours" ? var.yours_length : var.mine_length)
  
  prefix    = var.whose
}

Debug Output

https://gist.github.com/errygg/2d993c448b068a7cb5ca2c10bf4b4917

Expected Behavior

The provider should have detected the default separator -.

Actual Behavior

Plugin exited with error (see gist).

Steps to Reproduce

Manually build this provider from master and move it to ~/.terraform.d/plugins. Using the above config run:

  1. terraform apply

Important Factoids

As noted in the steps to reproduce, this provider was manually built and manually deployed since this provider is not yet released for Terraform 0.12.

Additionally, if the separator is specifically set in the random_pet resource, this plan and apply works as expected. Here is the hcl that works:

resource "random_pet" "pet" {

  length = (var.whose == "yours" ? var.yours_length : var.mine_length)
  
  prefix    = var.whose
  separator = "-"
}

errygg avatar Mar 11 '19 22:03 errygg

Hi @errygg! Thanks for reporting this.

I think the provider SDK vendored into the random provider may be too old for beta1; this bug looks like something that has been fixed already. If you still have the Go environment where you built the provider available, could you try updating the vendored copy and then building again?

The following steps should get the latest SDK from the master branch:

go get github.com/hashicorp/terraform@master
go mod vendor

If it works on the latest then that'll suggest that we need to upgrade the vendored SDK before releasing the provider's v3.0.0 version.

apparentlymart avatar Mar 12 '19 00:03 apparentlymart

This issue was resolved awhile back. 😄

bflad avatar May 03 '23 20:05 bflad

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.

github-actions[bot] avatar May 23 '24 09:05 github-actions[bot]