Skip to main content

CloudFrontDistributionSchema

The CloudFrontDistributionSchema class is the schema for the CloudFrontDistribution resource, which represents an AWS CloudFront distribution. Terraform provisions it as aws_cloudfront_distribution, alongside an aws_cloudfront_origin_access_control per S3 origin and one terraform resource per policy the distribution declares.

@group

Resources/CloudFrontDistribution

@overrideProperty

parents - The Lambda functions and ALBs it serves, each attached after construction, with addLambdaOrigin() and addAlbOrigin(). An S3 bucket is a child of the distribution instead.

@overrideProperty

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

Hierarchy

  • BaseResourceSchema
    • CloudFrontDistributionSchema

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: { aliases: string[]; awsAccountId: string; behaviors: CloudFrontBehaviorSchema[]; cachePolicies: CloudFrontCachePolicySchema[]; comment: string; customErrorResponses: CloudFrontCustomErrorResponseSchema[]; defaultRootObject: string; distributionName: string; enabled: boolean; geoRestriction: { countries: string[]; kind: allow | block } | { kind: none }; httpVersion: http1.1 | http2 | http2and3; originGroups: CloudFrontOriginGroupSchema[]; originRequestPolicies: CloudFrontOriginRequestPolicySchema[]; origins: CloudFrontOriginSchema[]; priceClass: PriceClass_100 | PriceClass_200 | PriceClass_All; responseHeadersPolicies: CloudFrontResponseHeadersPolicySchema[]; viewerCertificate: { certificateArn: string; kind: acm; minimumProtocolVersion: TLSv1 | TLSv1.1_2016 | TLSv1.2_2018 | TLSv1.2_2019 | TLSv1.2_2021 | TLSv1.2_2025 | TLSv1.3_2025 | TLSv1_2016 } | { kind: default } }

Input properties.

  • properties.aliases - The custom domain names the distribution answers on, e.g. www.example.com, or *.example.com for every host under example.com. Each one needs a DNS record pointing at the distribution, which this resource does not create. Empty serves only the *.cloudfront.net domain CloudFront assigns.
  • properties.awsAccountId - The AWS account id.
  • properties.behaviors - The routing table. Exactly one entry has no pathPattern and is the default behavior; the rest are matched in order before it. See CloudFrontBehaviorSchema.
  • properties.cachePolicies - Cache policies this distribution declares. See CloudFrontCachePolicySchema.
  • properties.comment - A human-readable label, at most 128 characters. It is the only name a distribution carries in the console.
  • properties.customErrorResponses - What the viewer gets for an origin error. See CloudFrontCustomErrorResponseSchema.
  • properties.defaultRootObject - The object served for a request to the site root, e.g. index.html or docs/index.html, never starting with /. Empty passes the request to the origin as it is.
  • properties.distributionName - What names this distribution. Part of its identity.
  • properties.enabled - Whether the distribution serves traffic. Disabling is also the first half of deleting one, which AWS makes a slow operation.
  • properties.geoRestriction - Which countries may reach the distribution, each an uppercase two-letter ISO 3166-1 code, e.g. DE.
  • properties.httpVersion - See ICloudFrontHttpVersion.
  • properties.originGroups - Fail-over pairs over the origins. See CloudFrontOriginGroupSchema.
  • properties.originRequestPolicies - Origin request policies this distribution declares. See CloudFrontOriginRequestPolicySchema.
  • properties.origins - Where content comes from. See CloudFrontOriginSchema.
  • properties.priceClass - See ICloudFrontPriceClass.
  • properties.responseHeadersPolicies - Response headers policies this distribution declares. See CloudFrontResponseHeadersPolicySchema.
  • properties.viewerCertificate - The certificate viewers see. default serves CloudFront's own, which is valid only for the assigned *.cloudfront.net domain; acm serves a certificate of yours, which CloudFront reads from us-east-1 alone. See ICloudFrontMinimumProtocolVersion.

Type declaration

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: { Arn?: string; DistributionId?: string; DomainName?: string; HostedZoneId?: string } = { Arn: 'arn:aws:cloudfront::000000000000:distribution/E000000000000', DistributionId: 'E000000000000', DomainName: 'd000000000000.cloudfront.net', HostedZoneId: 'Z2FDTNDATAQYW2', }

Saved response.

  • response.Arn - The ARN of the distribution. A bucket admitting this distribution names it.
  • response.DistributionId - The distribution id, which is what an invalidation is issued against.
  • response.DomainName - The *.cloudfront.net domain CloudFront assigned. Point a DNS record at this.
  • response.HostedZoneId - The zone a Route 53 alias record pointing at this distribution needs.

Type declaration

  • optionalArn?: string
  • optionalDistributionId?: string
  • optionalDomainName?: string
  • optionalHostedZoneId?: 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