Random_password example error - what am I doing wrong?

Can anyone help me with this error? I’m following the example in the docs here

provider "random" {
    version = "~> 2.2"
}

resource "random_password" "password" {
    length  = 16
    special = true
}

resource "<any>_instance" "example" {
  ...
  password = random_string.password.result
}

result:

Error: Reference to undeclared resource

A managed resource "random_string" "password" has not been declared in the
root module.
1 Like

It should be random_password.password.result, shouldn’t it? Is this just a mistake in the docs? If so I’ll send a pull request to fix it

1 Like

You’re right @golightlyb ! Thanks for catching that.

1 Like

I should have checked the open pull requests first! Apparently a few people have done the same!

Woah. I’ll poke someone. Thanks for this nudge too.

1 Like

This was fixed as part of https://github.com/terraform-providers/terraform-provider-random/pull/77 which was the first PR in the queue.

I also deployed the fix so it’s live now at https://www.terraform.io/docs/providers/random/r/password.html

Sorry for any confusion caused by this typo and thanks for pointing it out.

1 Like

Typos happen :joy: thanks everyone.