We recommend new projects start with resources from the AWS provider.
aws-native.cloudfront.Function
Explore with Pulumi AI
We recommend new projects start with resources from the AWS provider.
Creates a CF function.
To create a function, you provide the function code and some configuration information about the function. The response contains an Amazon Resource Name (ARN) that uniquely identifies the function, and the function’s stage.
By default, when you create a function, it’s in the DEVELOPMENT
stage. In this stage, you can test the function in the CF console (or with TestFunction
in the CF API).
When you’re ready to use your function with a CF distribution, publish the function to the LIVE
stage. You can do this in the CF console, with PublishFunction
in the CF API, or by updating the AWS::CloudFront::Function
resource with the AutoPublish
property set to true
. When the function is published to the LIVE
stage, you can attach it to a distribution’s cache behavior, using the function’s ARN.
To automatically publish the function to the LIVE
stage when it’s created, set the AutoPublish
property to true
.
Create Function Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Function(name: string, args: FunctionArgs, opts?: CustomResourceOptions);
@overload
def Function(resource_name: str,
args: FunctionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Function(resource_name: str,
opts: Optional[ResourceOptions] = None,
function_code: Optional[str] = None,
function_config: Optional[FunctionConfigArgs] = None,
auto_publish: Optional[bool] = None,
function_metadata: Optional[FunctionMetadataArgs] = None,
name: Optional[str] = None)
func NewFunction(ctx *Context, name string, args FunctionArgs, opts ...ResourceOption) (*Function, error)
public Function(string name, FunctionArgs args, CustomResourceOptions? opts = null)
public Function(String name, FunctionArgs args)
public Function(String name, FunctionArgs args, CustomResourceOptions options)
type: aws-native:cloudfront:Function
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Function Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Function resource accepts the following input properties:
- Function
Code string - The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
- Function
Config Pulumi.Aws Native. Cloud Front. Inputs. Function Config - Contains configuration information about a CloudFront function.
- Auto
Publish bool - A flag that determines whether to automatically publish the function to the
LIVE
stage when it’s created. To automatically publish to theLIVE
stage, set this property totrue
. - Function
Metadata Pulumi.Aws Native. Cloud Front. Inputs. Function Metadata - Contains metadata about a CloudFront function.
- Name string
- A name to identify the function.
- Function
Code string - The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
- Function
Config FunctionConfig Args - Contains configuration information about a CloudFront function.
- Auto
Publish bool - A flag that determines whether to automatically publish the function to the
LIVE
stage when it’s created. To automatically publish to theLIVE
stage, set this property totrue
. - Function
Metadata FunctionMetadata Args - Contains metadata about a CloudFront function.
- Name string
- A name to identify the function.
- function
Code String - The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
- function
Config FunctionConfig - Contains configuration information about a CloudFront function.
- auto
Publish Boolean - A flag that determines whether to automatically publish the function to the
LIVE
stage when it’s created. To automatically publish to theLIVE
stage, set this property totrue
. - function
Metadata FunctionMetadata - Contains metadata about a CloudFront function.
- name String
- A name to identify the function.
- function
Code string - The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
- function
Config FunctionConfig - Contains configuration information about a CloudFront function.
- auto
Publish boolean - A flag that determines whether to automatically publish the function to the
LIVE
stage when it’s created. To automatically publish to theLIVE
stage, set this property totrue
. - function
Metadata FunctionMetadata - Contains metadata about a CloudFront function.
- name string
- A name to identify the function.
- function_
code str - The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
- function_
config FunctionConfig Args - Contains configuration information about a CloudFront function.
- auto_
publish bool - A flag that determines whether to automatically publish the function to the
LIVE
stage when it’s created. To automatically publish to theLIVE
stage, set this property totrue
. - function_
metadata FunctionMetadata Args - Contains metadata about a CloudFront function.
- name str
- A name to identify the function.
- function
Code String - The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
- function
Config Property Map - Contains configuration information about a CloudFront function.
- auto
Publish Boolean - A flag that determines whether to automatically publish the function to the
LIVE
stage when it’s created. To automatically publish to theLIVE
stage, set this property totrue
. - function
Metadata Property Map - Contains metadata about a CloudFront function.
- name String
- A name to identify the function.
Outputs
All input properties are implicitly available as output properties. Additionally, the Function resource produces the following output properties:
- Function
Arn string The ARN of the function. For example:
arn:aws:cloudfront::123456789012:function/ExampleFunction
.To get the function ARN, use the following syntax:
!GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
- Id string
- The provider-assigned unique ID for this managed resource.
- Stage string
- Function
Arn string The ARN of the function. For example:
arn:aws:cloudfront::123456789012:function/ExampleFunction
.To get the function ARN, use the following syntax:
!GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
- Id string
- The provider-assigned unique ID for this managed resource.
- Stage string
- function
Arn String The ARN of the function. For example:
arn:aws:cloudfront::123456789012:function/ExampleFunction
.To get the function ARN, use the following syntax:
!GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
- id String
- The provider-assigned unique ID for this managed resource.
- stage String
- function
Arn string The ARN of the function. For example:
arn:aws:cloudfront::123456789012:function/ExampleFunction
.To get the function ARN, use the following syntax:
!GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
- id string
- The provider-assigned unique ID for this managed resource.
- stage string
- function_
arn str The ARN of the function. For example:
arn:aws:cloudfront::123456789012:function/ExampleFunction
.To get the function ARN, use the following syntax:
!GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
- id str
- The provider-assigned unique ID for this managed resource.
- stage str
- function
Arn String The ARN of the function. For example:
arn:aws:cloudfront::123456789012:function/ExampleFunction
.To get the function ARN, use the following syntax:
!GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
- id String
- The provider-assigned unique ID for this managed resource.
- stage String
Supporting Types
FunctionConfig, FunctionConfigArgs
- Comment string
- A comment to describe the function.
- Runtime string
- The function's runtime environment version.
- Key
Value List<Pulumi.Store Associations Aws Native. Cloud Front. Inputs. Function Key Value Store Association> - The configuration for the key value store associations.
- Comment string
- A comment to describe the function.
- Runtime string
- The function's runtime environment version.
- Key
Value []FunctionStore Associations Key Value Store Association - The configuration for the key value store associations.
- comment String
- A comment to describe the function.
- runtime String
- The function's runtime environment version.
- key
Value List<FunctionStore Associations Key Value Store Association> - The configuration for the key value store associations.
- comment string
- A comment to describe the function.
- runtime string
- The function's runtime environment version.
- key
Value FunctionStore Associations Key Value Store Association[] - The configuration for the key value store associations.
- comment str
- A comment to describe the function.
- runtime str
- The function's runtime environment version.
- key_
value_ Sequence[Functionstore_ associations Key Value Store Association] - The configuration for the key value store associations.
- comment String
- A comment to describe the function.
- runtime String
- The function's runtime environment version.
- key
Value List<Property Map>Store Associations - The configuration for the key value store associations.
FunctionKeyValueStoreAssociation, FunctionKeyValueStoreAssociationArgs
- Key
Value stringStore Arn - The Amazon Resource Name (ARN) of the key value store association.
- Key
Value stringStore Arn - The Amazon Resource Name (ARN) of the key value store association.
- key
Value StringStore Arn - The Amazon Resource Name (ARN) of the key value store association.
- key
Value stringStore Arn - The Amazon Resource Name (ARN) of the key value store association.
- key_
value_ strstore_ arn - The Amazon Resource Name (ARN) of the key value store association.
- key
Value StringStore Arn - The Amazon Resource Name (ARN) of the key value store association.
FunctionMetadata, FunctionMetadataArgs
- Function
Arn string - The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.
- Function
Arn string - The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.
- function
Arn String - The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.
- function
Arn string - The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.
- function_
arn str - The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.
- function
Arn String - The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.
Package Details
- Repository
- AWS Native pulumi/pulumi-aws-native
- License
- Apache-2.0
We recommend new projects start with resources from the AWS provider.