1. Packages
  2. AWS
  3. API Docs
  4. cloudfront
  5. getFunction
AWS v6.78.0 published on Thursday, Apr 24, 2025 by Pulumi

aws.cloudfront.getFunction

Explore with Pulumi AI

AWS v6.78.0 published on Thursday, Apr 24, 2025 by Pulumi

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",
});
Copy
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")
Copy
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
	})
}
Copy
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",
    });

});
Copy
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());

    }
}
Copy
configuration:
  functionName:
    type: string
variables:
  existing:
    fn::invoke:
      function: aws:cloudfront:getFunction
      arguments:
        name: ${functionName}
        stage: LIVE
Copy

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>
Copy
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]
Copy
func LookupFunction(ctx *Context, args *LookupFunctionArgs, opts ...InvokeOption) (*LookupFunctionResult, error)
func LookupFunctionOutput(ctx *Context, args *LookupFunctionOutputArgs, opts ...InvokeOption) LookupFunctionResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetFunctionResult> getFunction(GetFunctionArgs args, InvokeOptions options)
public static Output<GetFunctionResult> getFunction(GetFunctionArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:cloudfront/getFunction:getFunction
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
Name of the CloudFront function.
Stage This property is required. string
Function’s stage, either DEVELOPMENT or LIVE.
Name This property is required. string
Name of the CloudFront function.
Stage This property is required. string
Function’s stage, either DEVELOPMENT or LIVE.
name This property is required. String
Name of the CloudFront function.
stage This property is required. String
Function’s stage, either DEVELOPMENT or LIVE.
name This property is required. string
Name of the CloudFront function.
stage This property is required. string
Function’s stage, either DEVELOPMENT or LIVE.
name This property is required. str
Name of the CloudFront function.
stage This property is required. str
Function’s stage, either DEVELOPMENT or LIVE.
name This property is required. String
Name of the CloudFront function.
stage This property is required. String
Function’s stage, either DEVELOPMENT or LIVE.

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.
KeyValueStoreAssociations List<string>
List of aws.cloudfront.KeyValueStore ARNs associated to the function.
LastModifiedTime string
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, UNASSOCIATED or ASSOCIATED.
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.
KeyValueStoreAssociations []string
List of aws.cloudfront.KeyValueStore ARNs associated to the function.
LastModifiedTime string
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, UNASSOCIATED or ASSOCIATED.
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.
keyValueStoreAssociations List<String>
List of aws.cloudfront.KeyValueStore ARNs associated to the function.
lastModifiedTime String
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, UNASSOCIATED or ASSOCIATED.
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.
keyValueStoreAssociations string[]
List of aws.cloudfront.KeyValueStore ARNs associated to the function.
lastModifiedTime string
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, UNASSOCIATED or ASSOCIATED.
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_store_associations Sequence[str]
List of aws.cloudfront.KeyValueStore ARNs associated to the function.
last_modified_time str
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, UNASSOCIATED or ASSOCIATED.
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.
keyValueStoreAssociations List<String>
List of aws.cloudfront.KeyValueStore ARNs associated to the function.
lastModifiedTime String
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, UNASSOCIATED or ASSOCIATED.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.
AWS v6.78.0 published on Thursday, Apr 24, 2025 by Pulumi