Function

class Function : KotlinCustomResource

Provides a CloudFront Function resource. With CloudFront Functions in Amazon CloudFront, you can write lightweight functions in JavaScript for high-scale, latency-sensitive CDN customizations. See CloudFront Functions

NOTE: You cannot delete a function if it’s associated with a cache behavior. First, update your distributions to remove the function association from all cache behaviors, then delete the function.

Example Usage

Basic Example

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudfront.Function;
import com.pulumi.aws.cloudfront.FunctionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new Function("test", FunctionArgs.builder()
.runtime("cloudfront-js-1.0")
.comment("my function")
.publish(true)
.code(Files.readString(Paths.get(String.format("%s/function.js", path.module()))))
.build());
}
}

Import

CloudFront Functions can be imported using the name, e.g.,

$ pulumi import aws:cloudfront/function:Function test my_test_function

Properties

Link copied to clipboard
val arn: Output<String>

Amazon Resource Name (ARN) identifying your CloudFront Function.

Link copied to clipboard
val code: Output<String>

Source code of the function

Link copied to clipboard
val comment: Output<String>?

Comment.

Link copied to clipboard
val etag: Output<String>

ETag hash of the function. This is the value for the DEVELOPMENT stage of the function.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val liveStageEtag: Output<String>

ETag hash of any LIVE stage of the function.

Link copied to clipboard
val name: Output<String>

Unique name for your CloudFront Function.

Link copied to clipboard
val publish: Output<Boolean>?

Whether to publish creation/change as Live CloudFront Function Version. Defaults to true.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val runtime: Output<String>

Identifier of the function's runtime. Currently only cloudfront-js-1.0 is valid. The following arguments are optional:

Link copied to clipboard
val status: Output<String>

Status of the function. Can be UNPUBLISHED, UNASSOCIATED or ASSOCIATED.

Link copied to clipboard
val urn: Output<String>