AWS v6.77.1 published on Friday, Apr 18, 2025 by Pulumi
aws.cloudfront.getFunction
Explore with Pulumi AI
Provides information about a CloudFront Function.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const config = new pulumi.Config();
const functionName = config.require("functionName");
const existing = aws.cloudfront.getFunction({
    name: functionName,
    stage: "LIVE",
});
import pulumi
import pulumi_aws as aws
config = pulumi.Config()
function_name = config.require("functionName")
existing = aws.cloudfront.get_function(name=function_name,
    stage="LIVE")
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudfront"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		functionName := cfg.Require("functionName")
		_, err := cloudfront.LookupFunction(ctx, &cloudfront.LookupFunctionArgs{
			Name:  functionName,
			Stage: "LIVE",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var functionName = config.Require("functionName");
    var existing = Aws.CloudFront.GetFunction.Invoke(new()
    {
        Name = functionName,
        Stage = "LIVE",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudfront.CloudfrontFunctions;
import com.pulumi.aws.cloudfront.inputs.GetFunctionArgs;
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) {
        final var config = ctx.config();
        final var functionName = config.get("functionName");
        final var existing = CloudfrontFunctions.getFunction(GetFunctionArgs.builder()
            .name(functionName)
            .stage("LIVE")
            .build());
    }
}
configuration:
  functionName:
    type: string
variables:
  existing:
    fn::invoke:
      function: aws:cloudfront:getFunction
      arguments:
        name: ${functionName}
        stage: LIVE
Using getFunction
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getFunction(args: GetFunctionArgs, opts?: InvokeOptions): Promise<GetFunctionResult>
function getFunctionOutput(args: GetFunctionOutputArgs, opts?: InvokeOptions): Output<GetFunctionResult>def get_function(name: Optional[str] = None,
                 stage: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetFunctionResult
def get_function_output(name: Optional[pulumi.Input[str]] = None,
                 stage: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetFunctionResult]func LookupFunction(ctx *Context, args *LookupFunctionArgs, opts ...InvokeOption) (*LookupFunctionResult, error)
func LookupFunctionOutput(ctx *Context, args *LookupFunctionOutputArgs, opts ...InvokeOption) LookupFunctionResultOutput> Note: This function is named LookupFunction in the Go SDK.
public static class GetFunction 
{
    public static Task<GetFunctionResult> InvokeAsync(GetFunctionArgs args, InvokeOptions? opts = null)
    public static Output<GetFunctionResult> Invoke(GetFunctionInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetFunctionResult> getFunction(GetFunctionArgs args, InvokeOptions options)
public static Output<GetFunctionResult> getFunction(GetFunctionArgs args, InvokeOptions options)
fn::invoke:
  function: aws:cloudfront/getFunction:getFunction
  arguments:
    # arguments dictionaryThe following arguments are supported:
getFunction Result
The following output properties are available:
- Arn string
 - ARN identifying your CloudFront Function.
 - Code string
 - Source code of the function
 - Comment string
 - Comment.
 - Etag string
 - ETag hash of the function
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Key
Value List<string>Store Associations  - List of 
aws.cloudfront.KeyValueStoreARNs associated to the function. - Last
Modified stringTime  - When this resource was last modified.
 - Name string
 - Runtime string
 - Identifier of the function's runtime.
 - Stage string
 - Status string
 - Status of the function. Can be 
UNPUBLISHED,UNASSOCIATEDorASSOCIATED. 
- Arn string
 - ARN identifying your CloudFront Function.
 - Code string
 - Source code of the function
 - Comment string
 - Comment.
 - Etag string
 - ETag hash of the function
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Key
Value []stringStore Associations  - List of 
aws.cloudfront.KeyValueStoreARNs associated to the function. - Last
Modified stringTime  - When this resource was last modified.
 - Name string
 - Runtime string
 - Identifier of the function's runtime.
 - Stage string
 - Status string
 - Status of the function. Can be 
UNPUBLISHED,UNASSOCIATEDorASSOCIATED. 
- arn String
 - ARN identifying your CloudFront Function.
 - code String
 - Source code of the function
 - comment String
 - Comment.
 - etag String
 - ETag hash of the function
 - id String
 - The provider-assigned unique ID for this managed resource.
 - key
Value List<String>Store Associations  - List of 
aws.cloudfront.KeyValueStoreARNs associated to the function. - last
Modified StringTime  - When this resource was last modified.
 - name String
 - runtime String
 - Identifier of the function's runtime.
 - stage String
 - status String
 - Status of the function. Can be 
UNPUBLISHED,UNASSOCIATEDorASSOCIATED. 
- arn string
 - ARN identifying your CloudFront Function.
 - code string
 - Source code of the function
 - comment string
 - Comment.
 - etag string
 - ETag hash of the function
 - id string
 - The provider-assigned unique ID for this managed resource.
 - key
Value string[]Store Associations  - List of 
aws.cloudfront.KeyValueStoreARNs associated to the function. - last
Modified stringTime  - When this resource was last modified.
 - name string
 - runtime string
 - Identifier of the function's runtime.
 - stage string
 - status string
 - Status of the function. Can be 
UNPUBLISHED,UNASSOCIATEDorASSOCIATED. 
- arn str
 - ARN identifying your CloudFront Function.
 - code str
 - Source code of the function
 - comment str
 - Comment.
 - etag str
 - ETag hash of the function
 - id str
 - The provider-assigned unique ID for this managed resource.
 - key_
value_ Sequence[str]store_ associations  - List of 
aws.cloudfront.KeyValueStoreARNs associated to the function. - last_
modified_ strtime  - When this resource was last modified.
 - name str
 - runtime str
 - Identifier of the function's runtime.
 - stage str
 - status str
 - Status of the function. Can be 
UNPUBLISHED,UNASSOCIATEDorASSOCIATED. 
- arn String
 - ARN identifying your CloudFront Function.
 - code String
 - Source code of the function
 - comment String
 - Comment.
 - etag String
 - ETag hash of the function
 - id String
 - The provider-assigned unique ID for this managed resource.
 - key
Value List<String>Store Associations  - List of 
aws.cloudfront.KeyValueStoreARNs associated to the function. - last
Modified StringTime  - When this resource was last modified.
 - name String
 - runtime String
 - Identifier of the function's runtime.
 - stage String
 - status String
 - Status of the function. Can be 
UNPUBLISHED,UNASSOCIATEDorASSOCIATED. 
Package Details
- Repository
 - AWS Classic pulumi/pulumi-aws
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
awsTerraform Provider.