-
Notifications
You must be signed in to change notification settings - Fork 115
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 tpm support #379
Add tpm support #379
Conversation
Hey @alemuro, Regarding the Adding this to the builder would indeed make it possible to use this workflow and benefit from the extra options that Alternatively, and this is more of a gamble, we could wait until there's another way to set this attribute on existing AMIs, much like what we experienced with the On another note, thanks for picking this PR up! I'll do another review pass now, and if it looks good, we can merge it. |
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.
Pre-approving in the expectative for a reroll with my comments addressed, but overall this looks good to me. The only thing I'd maybe like to see would be an acceptance test for ebssurrogate
, but as it stands I think it's good already, we can do another pass to make sure this works as intended.
Thanks for picking this up again @alemuro !
@@ -16,6 +16,7 @@ launch_block_device_mappings { | |||
encrypted = true | |||
kms_key_id = "1a2b3c4d-5e6f-1a2b-3c4d-5e6f1a2b3c4d" | |||
} | |||
|
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 wonder why this changed, is it something that happens when you run make generate
? If so we're good, I'm more curious than anything
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.
Yup! I didn't changed the file manually but with make generate
.
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.
Fixed.
builder/chroot/builder.go
Outdated
@@ -376,6 +380,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { | |||
errs = packersdk.MultiErrorAppend(errs, errors.New(`The only valid ami_architecture values are "arm64", "i386", "x86_64", or "x86_64_mac"`)) | |||
} | |||
|
|||
if b.config.TpmSupport != "" && b.config.TpmSupport != ec2.TpmSupportValuesV20 { | |||
errs = packersdk.MultiErrorAppend(errs, fmt.Errorf(`The only valid tpm_support values are %q or the empty string`, ec2.TpmSupportValuesV20)) |
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.
Little nit that I think I forgot to highlight in my first review, the or the empty string
part feels off to me, the empty string is the default value, which is equivalent to not specifying it, so I think we can rework this message to give out the only acceptable value.
errs = packersdk.MultiErrorAppend(errs, fmt.Errorf(`The only valid tpm_support values are %q or the empty string`, ec2.TpmSupportValuesV20)) | |
errs = packersdk.MultiErrorAppend(errs, fmt.Errorf(`The only valid tpm_support value is %q`, ec2.TpmSupportValuesV20)) |
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.
This would apply to all the builders that support the feature.
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.
Make sense, added to the three builders where this PR applies: chroot
, ebssurrogate
, and instance
.
Thanks!
5361101
to
7da7c1f
Compare
Morning @lbajolet-hashicorp , I've added tests to the other builders as requested, the $ make test
? github.com/hashicorp/packer-plugin-amazon [no test files]
ok github.com/hashicorp/packer-plugin-amazon/builder/chroot 1.088s
ok github.com/hashicorp/packer-plugin-amazon/builder/common 2.295s
? github.com/hashicorp/packer-plugin-amazon/builder/common/awserrors [no test files]
? github.com/hashicorp/packer-plugin-amazon/builder/common/ssm [no test files]
ok github.com/hashicorp/packer-plugin-amazon/builder/ebs 6.472s
? github.com/hashicorp/packer-plugin-amazon/builder/ebs/acceptance [no test files]
ok github.com/hashicorp/packer-plugin-amazon/builder/ebssurrogate 1.100s
ok github.com/hashicorp/packer-plugin-amazon/builder/ebsvolume 2.581s
ok github.com/hashicorp/packer-plugin-amazon/builder/instance 2.985s
ok github.com/hashicorp/packer-plugin-amazon/datasource/ami 0.880s
ok github.com/hashicorp/packer-plugin-amazon/datasource/parameterstore 2.580s
ok github.com/hashicorp/packer-plugin-amazon/datasource/secretsmanager 3.102s
? github.com/hashicorp/packer-plugin-amazon/post-processor/import [no test files]
? github.com/hashicorp/packer-plugin-amazon/version [no test files] Regarding the Thanks for your revision! |
Ok I saw the Now it should be fine. |
Hi @alemuro, Thanks for being so quick at integrating my comments, much appreciated! With this reroll, it all looks good to me, I'm merging this now. |
Hello @lbajolet-hashicorp , do you have a tentative date on when this PR will be released on a new release? Thanks!! |
Hi @alemuro, Considering it's been a few weeks since the last release, and from what I see we don't have a ton on the table on this plugin now, we can probably release a new version soon, in the coming days or maybe next week sounds feasible I would think! |
Cool thanks! |
Hello! 👋
I'm interested in merging the PR #339 but it seems there is no activity since March. For that reason I opened a this PR with changes (and history commits) from the other PR + addressing the comments from that PR and rebasing the branch against the
main
branch.The author says on its MR:
I'm also interested in adding this feature to the
ebs
builder. I'm not sure if this is a good opportunity to change theebs
builder to use the Register API, or if I should raise another PR for that use case. What do you guys think?Tests
I've run
go build
andmake test
and seems to work with no issues. I also triedmake testacc
Closes #314