Skip to content

Commit

Permalink
resource/random_password: Fix bcrypt_hash generation (#308)
Browse files Browse the repository at this point in the history
Reference: #307

This change fixes the source of the `bcrypt_hash` generation to being the result of the random password generation. The issue was introduced in v3.4.0.

Previously:

```
--- FAIL: TestAccResourcePassword_BcryptHash (0.63s)
    /Users/bflad/src/github.com/hashicorp/terraform-provider-random/internal/provider/resource_password_test.go:107: Step 1/1 error: Check failed: Check 3/3 error: crypto/bcrypt: hashedPassword is not the hash of the given password
```

Suggested CHANGELOG:

```
NOTES:

* resource/random_password: If the resource was created between versions 3.4.0 and 3.4.2, the `bcrypt_hash` value would not correctly verify against the `result` value. Affected resources will automatically regenerate a valid `bcrypt_hash` after this upgrade.

BUG FIXES:

* resource/random_password: Fixed incorrect `bcrypt_hash` generation since version 3.4.0
```
  • Loading branch information
bflad authored Sep 6, 2022
1 parent 94c2c7b commit d324547
Show file tree
Hide file tree
Showing 4 changed files with 826 additions and 28 deletions.
9 changes: 9 additions & 0 deletions internal/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,12 @@ func providerVersion332() map[string]resource.ExternalProvider {
},
}
}

func providerVersion342() map[string]resource.ExternalProvider {
return map[string]resource.ExternalProvider{
"random": {
VersionConstraint: "3.4.2",
Source: "hashicorp/random",
},
}
}
Loading

0 comments on commit d324547

Please sign in to comment.