awscc_cloudfront_function (Resource)

Resource Type definition for AWS::CloudFront::Function

Example Usage

Basic Example

resource "awscc_cloudfront_function" "example" {
  name          = "example"
  function_code = file("${path.module}/function.js")
  function_config = {
    comment = "example function"
    runtime = "cloudfront-js-2.0"
  }
  auto_publish = true
}

With key value store association

resource "awscc_cloudfront_function" "example" {
  name          = "example"
  function_code = file("${path.module}/function.js")
  function_config = {
    comment = "example function"
    runtime = "cloudfront-js-2.0"
    key_value_store_associations = [{
      key_value_store_arn = var.key_store_arn
    }]
  }
  auto_publish = true
}

variable "key_store_arn" {
  type        = string
  description = "Key Value store arn"
}

Schema

Required

Optional

Read-Only

Nested Schema for function_config

Required:

Optional:

Nested Schema for function_config.key_value_store_associations

Required:

Nested Schema for function_metadata

Read-Only:

Import

Import is supported using the following syntax:

$ terraform import awscc_cloudfront_function.example <resource ID>