Skip to main content

CloudFrontInvalidationSchema

The CloudFrontInvalidationSchema class is the schema for the CloudFrontInvalidation resource, which drops what CloudFront's edge locations are holding for a distribution.

Terraform provisions no part of it. There is no managed resource in the AWS provider for an invalidation, because an invalidation is not a thing that exists - it is a call that runs and finishes. So this is an external resource: octo issues CreateInvalidation itself, through the octo run-action callback terraform makes mid-apply.

It exists because the alternative is silent. A distribution serving a bucket caches an object for as long as its cache policy says, which for Managed-CachingOptimized is a day, and an S3 object carries no Cache-Control of its own. Without this, uploading a new version of a site reports success and changes nothing a visitor can see until the next day.

@group

Resources/CloudFrontInvalidation

@overrideProperty

parents - The distribution whose edge caches are dropped, and the bucket whose files they hold, so the invalidation runs after the upload.

@overrideProperty

resourceId - The resource id is of format cloudfront-invalidation-<distribution-name>-<bucket-name>.

Hierarchy

  • BaseResourceSchema
    • CloudFrontInvalidationSchema

Index

Properties

inheritedlocalResourceId

localResourceId: string

The ID the resource was created with, unique within its scope.

inheritedparents

parents: IResourceReference[]

The resources this one is built on top of.

properties

properties: { awsAccountId: string; contentVersion: string; paths: string[] }

Input properties.

  • properties.awsAccountId - The AWS account id.
  • properties.contentVersion - What the distribution is currently serving. It is not read by the call; it is the whole trigger. Octo re-runs this resource when this value moves, and does nothing when it does not, so whoever owns the content decides when an invalidation happens by deciding what this says. A digest over the published files is the usual answer.
  • properties.paths - The paths to drop, e.g. /*. AWS bills per path beyond the first thousand a month, and /* counts as one.

Type declaration

  • awsAccountId: string
  • contentVersion: string
  • paths: string[]

inheritedresourceId

resourceId: string

The ID of the resource, unique across the infrastructure: its localResourceId, followed by a hash of its scope when it has one.

response

response: { InvalidationId?: string } = { InvalidationId: 'I000000000000', }

Saved response.

  • response.InvalidationId - The id AWS assigned the invalidation that ran.

Type declaration

  • optionalInvalidationId?: string

inheritedscope

scope: string[]

The contexts of the models the resource is placed under, derived from where the node creating it sits in the model graph. Octo sets it; a resource created outside a model action has none.

inheritedtags

tags: {}

The tags applied to the resource.


Type declaration

  • [key string]: string