-
Notifications
You must be signed in to change notification settings - Fork 63
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
add output_sha256 attribute #74
Conversation
bd7c15e
to
a05a276
Compare
a05a276
to
7cd4111
Compare
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
thanks @bdchauvette for the great work! is there any way this could be rebased and merged? I'm currently having issues with this blocking me as well |
When will this be merged? Blocking me as well on AWS SSM. |
sha256base64 := base64.StdEncoding.EncodeToString(shaSum[:]) | ||
|
||
md5 := md5.New() | ||
md5.Write([]byte(data)) | ||
md5Sum := hex.EncodeToString(md5.Sum(nil)) | ||
|
||
return sha1, sha256base64, md5Sum, nil | ||
return sha1, sha256hex, sha256base64, md5Sum, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might I suggest adding all the missing hash algorithms, per hashicorp/terraform-provider-local#137
E.g.
func genFileShas(filename string) (sha1Hex, sha256Hex, sha256Base64, sha512Hex, sha512Base64, md5Hex string, err error) {
data, err := ioutil.ReadFile(filename)
if err != nil {
err = fmt.Errorf("could not compute file '%s' checksum: %s", filename, err)
return
}
sha1Sum := sha1.Sum(data)
sha1Hex = hex.EncodeToString(sha1Sum[:])
sha256Sum := sha256.Sum256(data)
sha256Hex = hex.EncodeToString(sha256Sum[:])
sha256Base64 = base64.StdEncoding.EncodeToString(sha256Sum[:])
sha512Sum := sha512.Sum512(data)
sha512Hex = hex.EncodeToString(sha512Sum[:])
sha512Base64 = base64.StdEncoding.EncodeToString(sha512Sum[:])
md5Sum := md5.Sum(data)
md5Hex = hex.EncodeToString(md5Sum[:])
return
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to open a new PR for my suggested changes #165
Don't know how much more successful my PR will be than this one 😐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not actually using this provider anymore so I'm happy to close this PR in favor of yours 👍
Closing in favor of #165 See #74 (comment) |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Hello!
I'm using this provider to create some archives for AWS SSM Distributor. AWS requires each package to have a manifest with hex SHA256 sums. As far as I can tell, there's no simple way to convert the base64 sum to a hex sum using Terraform functions, which I think makes it a good candidate for being done on the provider level.