ConnectionFunction class
Manages an AWS CloudFront Connection Function.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cloudfront.ConnectionFunction("example", {
connectionFunctionConfig: {
runtime: "cloudfront-js-2.0",
comment: "Example connection function",
},
name: "example-connection-function",
connectionFunctionCode: "function handler(event) { return event.request; }",
});
import pulumi
import pulumi_aws as aws
example = aws.cloudfront.ConnectionFunction("example",
connection_function_config={
"runtime": "cloudfront-js-2.0",
"comment": "Example connection function",
},
name="example-connection-function",
connection_function_code="function handler(event) { return event.request; }")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.CloudFront.ConnectionFunction("example", new()
{
ConnectionFunctionConfig = new Aws.CloudFront.Inputs.ConnectionFunctionConnectionFunctionConfigArgs
{
Runtime = "cloudfront-js-2.0",
Comment = "Example connection function",
},
Name = "example-connection-function",
ConnectionFunctionCode = "function handler(event) { return event.request; }",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cloudfront"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudfront.NewConnectionFunction(ctx, "example", &cloudfront.ConnectionFunctionArgs{
ConnectionFunctionConfig: &cloudfront.ConnectionFunctionConnectionFunctionConfigArgs{
Runtime: pulumi.String("cloudfront-js-2.0"),
Comment: pulumi.String("Example connection function"),
},
Name: pulumi.String("example-connection-function"),
ConnectionFunctionCode: pulumi.String("function handler(event) { return event.request; }"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_cloudfront_connectionfunction" "example" {
connection_function_config = {
runtime = "cloudfront-js-2.0"
comment = "Example connection function"
}
name = "example-connection-function"
connection_function_code = "function handler(event) { return event.request; }"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudfront.ConnectionFunction;
import com.pulumi.aws.cloudfront.ConnectionFunctionArgs;
import com.pulumi.aws.cloudfront.inputs.ConnectionFunctionConnectionFunctionConfigArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 example = new ConnectionFunction("example", ConnectionFunctionArgs.builder()
.connectionFunctionConfig(ConnectionFunctionConnectionFunctionConfigArgs.builder()
.runtime("cloudfront-js-2.0")
.comment("Example connection function")
.build())
.name("example-connection-function")
.connectionFunctionCode("function handler(event) { return event.request; }")
.build());
}
}
resources:
example:
type: aws:cloudfront:ConnectionFunction
properties:
connectionFunctionConfig:
runtime: cloudfront-js-2.0
comment: Example connection function
name: example-connection-function
connectionFunctionCode: function handler(event) { return event.request; }
With Publish Enabled
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cloudfront.ConnectionFunction("example", {
connectionFunctionConfig: {
runtime: "cloudfront-js-2.0",
comment: "Example connection function",
},
name: "example-connection-function",
connectionFunctionCode: "function handler(event) { return event.request; }",
publish: true,
});
import pulumi
import pulumi_aws as aws
example = aws.cloudfront.ConnectionFunction("example",
connection_function_config={
"runtime": "cloudfront-js-2.0",
"comment": "Example connection function",
},
name="example-connection-function",
connection_function_code="function handler(event) { return event.request; }",
publish=True)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.CloudFront.ConnectionFunction("example", new()
{
ConnectionFunctionConfig = new Aws.CloudFront.Inputs.ConnectionFunctionConnectionFunctionConfigArgs
{
Runtime = "cloudfront-js-2.0",
Comment = "Example connection function",
},
Name = "example-connection-function",
ConnectionFunctionCode = "function handler(event) { return event.request; }",
Publish = true,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cloudfront"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudfront.NewConnectionFunction(ctx, "example", &cloudfront.ConnectionFunctionArgs{
ConnectionFunctionConfig: &cloudfront.ConnectionFunctionConnectionFunctionConfigArgs{
Runtime: pulumi.String("cloudfront-js-2.0"),
Comment: pulumi.String("Example connection function"),
},
Name: pulumi.String("example-connection-function"),
ConnectionFunctionCode: pulumi.String("function handler(event) { return event.request; }"),
Publish: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_cloudfront_connectionfunction" "example" {
connection_function_config = {
runtime = "cloudfront-js-2.0"
comment = "Example connection function"
}
name = "example-connection-function"
connection_function_code = "function handler(event) { return event.request; }"
publish = true
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudfront.ConnectionFunction;
import com.pulumi.aws.cloudfront.ConnectionFunctionArgs;
import com.pulumi.aws.cloudfront.inputs.ConnectionFunctionConnectionFunctionConfigArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 example = new ConnectionFunction("example", ConnectionFunctionArgs.builder()
.connectionFunctionConfig(ConnectionFunctionConnectionFunctionConfigArgs.builder()
.runtime("cloudfront-js-2.0")
.comment("Example connection function")
.build())
.name("example-connection-function")
.connectionFunctionCode("function handler(event) { return event.request; }")
.publish(true)
.build());
}
}
resources:
example:
type: aws:cloudfront:ConnectionFunction
properties:
connectionFunctionConfig:
runtime: cloudfront-js-2.0
comment: Example connection function
name: example-connection-function
connectionFunctionCode: function handler(event) { return event.request; }
publish: true
With Key Value Store Associations
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cloudfront.KeyValueStore("example", {
name: "example-kvs",
comment: "Example key value store",
});
const exampleConnectionFunction = new aws.cloudfront.ConnectionFunction("example", {
connectionFunctionConfig: {
keyValueStoreAssociation: {
keyValueStoreArn: example.arn,
},
runtime: "cloudfront-js-2.0",
comment: "Example connection function",
},
name: "example-connection-function",
connectionFunctionCode: "function handler(event) { return event.request; }",
});
import pulumi
import pulumi_aws as aws
example = aws.cloudfront.KeyValueStore("example",
name="example-kvs",
comment="Example key value store")
example_connection_function = aws.cloudfront.ConnectionFunction("example",
connection_function_config={
"key_value_store_association": {
"key_value_store_arn": example.arn,
},
"runtime": "cloudfront-js-2.0",
"comment": "Example connection function",
},
name="example-connection-function",
connection_function_code="function handler(event) { return event.request; }")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.CloudFront.KeyValueStore("example", new()
{
Name = "example-kvs",
Comment = "Example key value store",
});
var exampleConnectionFunction = new Aws.CloudFront.ConnectionFunction("example", new()
{
ConnectionFunctionConfig = new Aws.CloudFront.Inputs.ConnectionFunctionConnectionFunctionConfigArgs
{
KeyValueStoreAssociation = new Aws.CloudFront.Inputs.ConnectionFunctionConnectionFunctionConfigKeyValueStoreAssociationArgs
{
KeyValueStoreArn = example.Arn,
},
Runtime = "cloudfront-js-2.0",
Comment = "Example connection function",
},
Name = "example-connection-function",
ConnectionFunctionCode = "function handler(event) { return event.request; }",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cloudfront"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := cloudfront.NewKeyValueStore(ctx, "example", &cloudfront.KeyValueStoreArgs{
Name: pulumi.String("example-kvs"),
Comment: pulumi.String("Example key value store"),
})
if err != nil {
return err
}
_, err = cloudfront.NewConnectionFunction(ctx, "example", &cloudfront.ConnectionFunctionArgs{
ConnectionFunctionConfig: &cloudfront.ConnectionFunctionConnectionFunctionConfigArgs{
KeyValueStoreAssociation: &cloudfront.ConnectionFunctionConnectionFunctionConfigKeyValueStoreAssociationArgs{
KeyValueStoreArn: example.Arn,
},
Runtime: pulumi.String("cloudfront-js-2.0"),
Comment: pulumi.String("Example connection function"),
},
Name: pulumi.String("example-connection-function"),
ConnectionFunctionCode: pulumi.String("function handler(event) { return event.request; }"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_cloudfront_keyvaluestore" "example" {
name = "example-kvs"
comment = "Example key value store"
}
resource "aws_cloudfront_connectionfunction" "example" {
connection_function_config = {
key_value_store_association = {
key_value_store_arn = aws_cloudfront_keyvaluestore.example.arn
}
runtime = "cloudfront-js-2.0"
comment = "Example connection function"
}
name = "example-connection-function"
connection_function_code = "function handler(event) { return event.request; }"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudfront.KeyValueStore;
import com.pulumi.aws.cloudfront.KeyValueStoreArgs;
import com.pulumi.aws.cloudfront.ConnectionFunction;
import com.pulumi.aws.cloudfront.ConnectionFunctionArgs;
import com.pulumi.aws.cloudfront.inputs.ConnectionFunctionConnectionFunctionConfigArgs;
import com.pulumi.aws.cloudfront.inputs.ConnectionFunctionConnectionFunctionConfigKeyValueStoreAssociationArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 example = new KeyValueStore("example", KeyValueStoreArgs.builder()
.name("example-kvs")
.comment("Example key value store")
.build());
var exampleConnectionFunction = new ConnectionFunction("exampleConnectionFunction", ConnectionFunctionArgs.builder()
.connectionFunctionConfig(ConnectionFunctionConnectionFunctionConfigArgs.builder()
.keyValueStoreAssociation(ConnectionFunctionConnectionFunctionConfigKeyValueStoreAssociationArgs.builder()
.keyValueStoreArn(example.arn())
.build())
.runtime("cloudfront-js-2.0")
.comment("Example connection function")
.build())
.name("example-connection-function")
.connectionFunctionCode("function handler(event) { return event.request; }")
.build());
}
}
resources:
example:
type: aws:cloudfront:KeyValueStore
properties:
name: example-kvs
comment: Example key value store
exampleConnectionFunction:
type: aws:cloudfront:ConnectionFunction
name: example
properties:
connectionFunctionConfig:
keyValueStoreAssociation:
keyValueStoreArn: ${example.arn}
runtime: cloudfront-js-2.0
comment: Example connection function
name: example-connection-function
connectionFunctionCode: function handler(event) { return event.request; }
With Tags
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cloudfront.ConnectionFunction("example", {
connectionFunctionConfig: {
runtime: "cloudfront-js-2.0",
comment: "Example connection function",
},
name: "example-connection-function",
connectionFunctionCode: "function handler(event) { return event.request; }",
tags: {
Environment: "production",
Team: "web",
},
});
import pulumi
import pulumi_aws as aws
example = aws.cloudfront.ConnectionFunction("example",
connection_function_config={
"runtime": "cloudfront-js-2.0",
"comment": "Example connection function",
},
name="example-connection-function",
connection_function_code="function handler(event) { return event.request; }",
tags={
"Environment": "production",
"Team": "web",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.CloudFront.ConnectionFunction("example", new()
{
ConnectionFunctionConfig = new Aws.CloudFront.Inputs.ConnectionFunctionConnectionFunctionConfigArgs
{
Runtime = "cloudfront-js-2.0",
Comment = "Example connection function",
},
Name = "example-connection-function",
ConnectionFunctionCode = "function handler(event) { return event.request; }",
Tags =
{
{ "Environment", "production" },
{ "Team", "web" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cloudfront"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudfront.NewConnectionFunction(ctx, "example", &cloudfront.ConnectionFunctionArgs{
ConnectionFunctionConfig: &cloudfront.ConnectionFunctionConnectionFunctionConfigArgs{
Runtime: pulumi.String("cloudfront-js-2.0"),
Comment: pulumi.String("Example connection function"),
},
Name: pulumi.String("example-connection-function"),
ConnectionFunctionCode: pulumi.String("function handler(event) { return event.request; }"),
Tags: pulumi.StringMap{
"Environment": pulumi.String("production"),
"Team": pulumi.String("web"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_cloudfront_connectionfunction" "example" {
connection_function_config = {
runtime = "cloudfront-js-2.0"
comment = "Example connection function"
}
name = "example-connection-function"
connection_function_code = "function handler(event) { return event.request; }"
tags = {
"Environment" = "production"
"Team" = "web"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudfront.ConnectionFunction;
import com.pulumi.aws.cloudfront.ConnectionFunctionArgs;
import com.pulumi.aws.cloudfront.inputs.ConnectionFunctionConnectionFunctionConfigArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 example = new ConnectionFunction("example", ConnectionFunctionArgs.builder()
.connectionFunctionConfig(ConnectionFunctionConnectionFunctionConfigArgs.builder()
.runtime("cloudfront-js-2.0")
.comment("Example connection function")
.build())
.name("example-connection-function")
.connectionFunctionCode("function handler(event) { return event.request; }")
.tags(Map.ofEntries(
Map.entry("Environment", "production"),
Map.entry("Team", "web")
))
.build());
}
}
resources:
example:
type: aws:cloudfront:ConnectionFunction
properties:
connectionFunctionConfig:
runtime: cloudfront-js-2.0
comment: Example connection function
name: example-connection-function
connectionFunctionCode: function handler(event) { return event.request; }
tags:
Environment: production
Team: web
Import
Using pulumi import, import CloudFront Connection Function using the function ID. For example:
$ pulumi import aws:cloudfront/connectionFunction:ConnectionFunction example E1PA6795UKMFR9
Constructors
- ConnectionFunction(String name, {ConnectionFunctionArgs? args, CustomResourceOptions? options})
-
Creates a new ConnectionFunction.
nameThe Pulumi resource name.argsArguments used to configure this ConnectionFunction. The set of arguments for ConnectionFunction.optionsResource options controlling this resource's behavior. - ConnectionFunction.reference(String urn)
- Creates a typed reference to an existing ConnectionFunction resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
connectionFunctionArn
↔ Output<
String> -
ARN of the connection function.
latefinal
-
connectionFunctionCode
↔ Output<
String> -
Code for the connection function. Maximum length is 40960 characters.
latefinal
-
connectionFunctionConfig
↔ Output<
ConnectionFunctionConnectionFunctionConfig> -
Configuration information for the connection function. See
connectionFunctionConfigbelow.latefinal -
etag
↔ Output<
String> -
ETag of the connection function.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
liveStageEtag
↔ Output<
String> -
ETag of the function's LIVE stage. Will be empty if the function has not been published.
latefinal
-
name
↔ Output<
String> -
Name for the connection function. Must be 1-64 characters and can contain letters, numbers, hyphens, and underscores. Changing this forces a new resource to be created.
latefinal
-
publish
↔ Output<
bool> -
Whether to publish the function to the
LIVEstage after creation or update. Defaults tofalse.latefinal -
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
status
↔ Output<
String> -
Status of the connection function.
latefinal
-
Map of tags to assign to the resource. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
Map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {ConnectionFunctionState? state, CustomResourceOptions? options}) → ConnectionFunction -
Gets an existing ConnectionFunction resource's state with the given
nameandid.