Revocation and inherited revocation

How revoking an image version in HCP Packer stops new builds from using it, flags it to Terraform, and can flow down to every image built on top of it.

GazeekTERRAFORM AND PACKER: INFRASTRUCTURE AS CODE·LESSON 21
LESSON 21

Revocation and inherited revocation

How revoking an image version in HCP Packer stops new builds from using it, flags it to Terraform, and can flow down to every image built on top of it.

0:00 / 3:37

Diagrams in this video · 2Free in archhy

Copy and edit in archhy: Inherited revocation (new tab)
Copy and edit in archhy: What a revoked version does (new tab)

After this lesson you can

  • Explain what revoking a version does in HCP Packer
  • Compare immediate and scheduled revocation
  • Describe inherited revocation down an image's ancestry
  • Describe how Packer and Terraform react to a revoked version
Transcript

Revocation and inherited revocation

Space Llama here. Picture this. A serious vulnerability is announced, and it's in your base image. Every server built from that image is at risk, and so is every image built on top of it. Today, the big red button. Revocation.

Revoking a version

When you revoke a version in HCP Packer, the registry on the HashiCorp Cloud Platform, you mark it as unsafe to use. Packer can't build from a template that references a revoked version. The build stops. The metadata doesn't vanish, though. It stays in the registry until you delete it yourself, so you still know what was built. And you can restore a version, if the alarm turns out to be false. Revoking doesn't delete the image from your cloud. It tells everyone who asks the registry to stop using it.

Now, or on a date

You can revoke right away. That's for genuine emergencies. Or, in HCP Packer's Standard edition, you can schedule revocation for a date. Until that date, the version stays valid. It gives teams time to move to a fixed image, without a fire drill. Scheduling is kinder for routine retirements, like an operating system reaching the end of its support.

Inherited revocation

Remember ancestry from the registry lesson? This is where it pays off. Base version seven is revoked. Web version twelve and API version five were built on top of it. When you revoke base seven, you can choose to revoke all its descendants too. That's inherited revocation. So web twelve and API five are revoked, and so is web G P U two, built on web twelve. Grandchildren included. An explicit revocation on a child always beats an inherited one. And you can't restore a child while its parent is still revoked. Fix the parent first. Here, that's the patched base version eight.

What a revoked version does

So what does revocation actually change? For Packer, any build that asks for a revoked version fails. No new images built on a bad parent. Terraform still gets the metadata, plus a revoke at attribute with the revocation time. Your configuration can check that, and HCP Terraform's artifact validation run task can flag plans that use revoked images. More in Part 7. And a scheduled revocation keeps working until its date arrives.

A revocation drill

Let's run the drill once, calmly. Find the bad version. The registry tells you which bucket, which builds, and which images were built on it. Revoke it, and choose to revoke its descendants too. If it's on a channel, choose rollback, and the channel moves back to the last good version. Rebuild the parent with the fix, then rebuild the children on top of the new parent. Test them, promote them through the channels, and the servers move to safe images.

Recap

Let's recap. Revoke a version when it's no longer safe to use. Its metadata stays for the record. Revoke right away, or schedule it for a date. Descendants can inherit the revocation, all the way down the family tree. Packer refuses to build from it, and Terraform is told through revoke at.

Practice and what's next

That's revocation. One click, Packer won't build on the bad image, and Terraform is told about it. Next lesson, Packer meets Terraform, where the image registry finally feeds your infrastructure. See you there. That's the part. There's more on the channel. Alpaca Mango. Go on, then. Mate.

Gazeek Flash · free

Exam questions on your phone

Free questions on HCP Packer, the image registry: quick-fire batches and timed exams, on the web or Android.