Resource: aws_cloudfront_public_key

Example Usage

The following example below creates a CloudFront public key.

resource "aws_cloudfront_public_key" "example" {
  comment     = "test public key"
  encoded_key = file("public_key.pem")
  name        = "test_key"
}

Argument Reference

This resource supports the following arguments:

NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of terraform will want to recreate the aws_cloudfront_public_key resource.

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import CloudFront Public Key using the id. For example:

import {
  to = aws_cloudfront_public_key.example
  id = "K3D5EWEUDCCXON"
}

Using terraform import, import CloudFront Public Key using the id. For example:

% terraform import aws_cloudfront_public_key.example K3D5EWEUDCCXON