aws logo
AWS Classic v5.28.0, Jan 23 23

aws.cloudfront.OriginRequestPolicy

Import

Cloudfront Origin Request Policies can be imported using the id, e.g.

 $ pulumi import aws:cloudfront/originRequestPolicy:OriginRequestPolicy policy ccca32ef-dce3-4df3-80df-1bd3000bc4d3

Example Usage

The following example below creates a CloudFront origin request policy.

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.CloudFront.OriginRequestPolicy("example", new()
    {
        Comment = "example comment",
        CookiesConfig = new Aws.CloudFront.Inputs.OriginRequestPolicyCookiesConfigArgs
        {
            CookieBehavior = "whitelist",
            Cookies = new Aws.CloudFront.Inputs.OriginRequestPolicyCookiesConfigCookiesArgs
            {
                Items = new[]
                {
                    "example",
                },
            },
        },
        HeadersConfig = new Aws.CloudFront.Inputs.OriginRequestPolicyHeadersConfigArgs
        {
            HeaderBehavior = "whitelist",
            Headers = new Aws.CloudFront.Inputs.OriginRequestPolicyHeadersConfigHeadersArgs
            {
                Items = new[]
                {
                    "example",
                },
            },
        },
        QueryStringsConfig = new Aws.CloudFront.Inputs.OriginRequestPolicyQueryStringsConfigArgs
        {
            QueryStringBehavior = "whitelist",
            QueryStrings = new Aws.CloudFront.Inputs.OriginRequestPolicyQueryStringsConfigQueryStringsArgs
            {
                Items = new[]
                {
                    "example",
                },
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/cloudfront"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudfront.NewOriginRequestPolicy(ctx, "example", &cloudfront.OriginRequestPolicyArgs{
			Comment: pulumi.String("example comment"),
			CookiesConfig: &cloudfront.OriginRequestPolicyCookiesConfigArgs{
				CookieBehavior: pulumi.String("whitelist"),
				Cookies: &cloudfront.OriginRequestPolicyCookiesConfigCookiesArgs{
					Items: pulumi.StringArray{
						pulumi.String("example"),
					},
				},
			},
			HeadersConfig: &cloudfront.OriginRequestPolicyHeadersConfigArgs{
				HeaderBehavior: pulumi.String("whitelist"),
				Headers: &cloudfront.OriginRequestPolicyHeadersConfigHeadersArgs{
					Items: pulumi.StringArray{
						pulumi.String("example"),
					},
				},
			},
			QueryStringsConfig: &cloudfront.OriginRequestPolicyQueryStringsConfigArgs{
				QueryStringBehavior: pulumi.String("whitelist"),
				QueryStrings: &cloudfront.OriginRequestPolicyQueryStringsConfigQueryStringsArgs{
					Items: pulumi.StringArray{
						pulumi.String("example"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudfront.OriginRequestPolicy;
import com.pulumi.aws.cloudfront.OriginRequestPolicyArgs;
import com.pulumi.aws.cloudfront.inputs.OriginRequestPolicyCookiesConfigArgs;
import com.pulumi.aws.cloudfront.inputs.OriginRequestPolicyCookiesConfigCookiesArgs;
import com.pulumi.aws.cloudfront.inputs.OriginRequestPolicyHeadersConfigArgs;
import com.pulumi.aws.cloudfront.inputs.OriginRequestPolicyHeadersConfigHeadersArgs;
import com.pulumi.aws.cloudfront.inputs.OriginRequestPolicyQueryStringsConfigArgs;
import com.pulumi.aws.cloudfront.inputs.OriginRequestPolicyQueryStringsConfigQueryStringsArgs;
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 example = new OriginRequestPolicy("example", OriginRequestPolicyArgs.builder()        
            .comment("example comment")
            .cookiesConfig(OriginRequestPolicyCookiesConfigArgs.builder()
                .cookieBehavior("whitelist")
                .cookies(OriginRequestPolicyCookiesConfigCookiesArgs.builder()
                    .items("example")
                    .build())
                .build())
            .headersConfig(OriginRequestPolicyHeadersConfigArgs.builder()
                .headerBehavior("whitelist")
                .headers(OriginRequestPolicyHeadersConfigHeadersArgs.builder()
                    .items("example")
                    .build())
                .build())
            .queryStringsConfig(OriginRequestPolicyQueryStringsConfigArgs.builder()
                .queryStringBehavior("whitelist")
                .queryStrings(OriginRequestPolicyQueryStringsConfigQueryStringsArgs.builder()
                    .items("example")
                    .build())
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.cloudfront.OriginRequestPolicy("example",
    comment="example comment",
    cookies_config=aws.cloudfront.OriginRequestPolicyCookiesConfigArgs(
        cookie_behavior="whitelist",
        cookies=aws.cloudfront.OriginRequestPolicyCookiesConfigCookiesArgs(
            items=["example"],
        ),
    ),
    headers_config=aws.cloudfront.OriginRequestPolicyHeadersConfigArgs(
        header_behavior="whitelist",
        headers=aws.cloudfront.OriginRequestPolicyHeadersConfigHeadersArgs(
            items=["example"],
        ),
    ),
    query_strings_config=aws.cloudfront.OriginRequestPolicyQueryStringsConfigArgs(
        query_string_behavior="whitelist",
        query_strings=aws.cloudfront.OriginRequestPolicyQueryStringsConfigQueryStringsArgs(
            items=["example"],
        ),
    ))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.cloudfront.OriginRequestPolicy("example", {
    comment: "example comment",
    cookiesConfig: {
        cookieBehavior: "whitelist",
        cookies: {
            items: ["example"],
        },
    },
    headersConfig: {
        headerBehavior: "whitelist",
        headers: {
            items: ["example"],
        },
    },
    queryStringsConfig: {
        queryStringBehavior: "whitelist",
        queryStrings: {
            items: ["example"],
        },
    },
});
resources:
  example:
    type: aws:cloudfront:OriginRequestPolicy
    properties:
      comment: example comment
      cookiesConfig:
        cookieBehavior: whitelist
        cookies:
          items:
            - example
      headersConfig:
        headerBehavior: whitelist
        headers:
          items:
            - example
      queryStringsConfig:
        queryStringBehavior: whitelist
        queryStrings:
          items:
            - example

Create OriginRequestPolicy Resource

new OriginRequestPolicy(name: string, args: OriginRequestPolicyArgs, opts?: CustomResourceOptions);
@overload
def OriginRequestPolicy(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        comment: Optional[str] = None,
                        cookies_config: Optional[OriginRequestPolicyCookiesConfigArgs] = None,
                        headers_config: Optional[OriginRequestPolicyHeadersConfigArgs] = None,
                        name: Optional[str] = None,
                        query_strings_config: Optional[OriginRequestPolicyQueryStringsConfigArgs] = None)
@overload
def OriginRequestPolicy(resource_name: str,
                        args: OriginRequestPolicyArgs,
                        opts: Optional[ResourceOptions] = None)
func NewOriginRequestPolicy(ctx *Context, name string, args OriginRequestPolicyArgs, opts ...ResourceOption) (*OriginRequestPolicy, error)
public OriginRequestPolicy(string name, OriginRequestPolicyArgs args, CustomResourceOptions? opts = null)
public OriginRequestPolicy(String name, OriginRequestPolicyArgs args)
public OriginRequestPolicy(String name, OriginRequestPolicyArgs args, CustomResourceOptions options)
type: aws:cloudfront:OriginRequestPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args OriginRequestPolicyArgs
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 OriginRequestPolicyArgs
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 OriginRequestPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args OriginRequestPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args OriginRequestPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

OriginRequestPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The OriginRequestPolicy resource accepts the following input properties:

CookiesConfig OriginRequestPolicyCookiesConfigArgs

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

HeadersConfig OriginRequestPolicyHeadersConfigArgs

Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

QueryStringsConfig OriginRequestPolicyQueryStringsConfigArgs

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

Comment string

Comment to describe the origin request policy.

Name string

Unique name to identify the origin request policy.

CookiesConfig OriginRequestPolicyCookiesConfigArgs

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

HeadersConfig OriginRequestPolicyHeadersConfigArgs

Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

QueryStringsConfig OriginRequestPolicyQueryStringsConfigArgs

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

Comment string

Comment to describe the origin request policy.

Name string

Unique name to identify the origin request policy.

cookiesConfig OriginRequestPolicyCookiesConfigArgs

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

headersConfig OriginRequestPolicyHeadersConfigArgs

Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

queryStringsConfig OriginRequestPolicyQueryStringsConfigArgs

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

comment String

Comment to describe the origin request policy.

name String

Unique name to identify the origin request policy.

cookiesConfig OriginRequestPolicyCookiesConfigArgs

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

headersConfig OriginRequestPolicyHeadersConfigArgs

Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

queryStringsConfig OriginRequestPolicyQueryStringsConfigArgs

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

comment string

Comment to describe the origin request policy.

name string

Unique name to identify the origin request policy.

cookies_config OriginRequestPolicyCookiesConfigArgs

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

headers_config OriginRequestPolicyHeadersConfigArgs

Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

query_strings_config OriginRequestPolicyQueryStringsConfigArgs

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

comment str

Comment to describe the origin request policy.

name str

Unique name to identify the origin request policy.

cookiesConfig Property Map

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

headersConfig Property Map

Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

queryStringsConfig Property Map

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

comment String

Comment to describe the origin request policy.

name String

Unique name to identify the origin request policy.

Outputs

All input properties are implicitly available as output properties. Additionally, the OriginRequestPolicy resource produces the following output properties:

Etag string

The current version of the origin request policy.

Id string

The provider-assigned unique ID for this managed resource.

Etag string

The current version of the origin request policy.

Id string

The provider-assigned unique ID for this managed resource.

etag String

The current version of the origin request policy.

id String

The provider-assigned unique ID for this managed resource.

etag string

The current version of the origin request policy.

id string

The provider-assigned unique ID for this managed resource.

etag str

The current version of the origin request policy.

id str

The provider-assigned unique ID for this managed resource.

etag String

The current version of the origin request policy.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing OriginRequestPolicy Resource

Get an existing OriginRequestPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: OriginRequestPolicyState, opts?: CustomResourceOptions): OriginRequestPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        comment: Optional[str] = None,
        cookies_config: Optional[OriginRequestPolicyCookiesConfigArgs] = None,
        etag: Optional[str] = None,
        headers_config: Optional[OriginRequestPolicyHeadersConfigArgs] = None,
        name: Optional[str] = None,
        query_strings_config: Optional[OriginRequestPolicyQueryStringsConfigArgs] = None) -> OriginRequestPolicy
func GetOriginRequestPolicy(ctx *Context, name string, id IDInput, state *OriginRequestPolicyState, opts ...ResourceOption) (*OriginRequestPolicy, error)
public static OriginRequestPolicy Get(string name, Input<string> id, OriginRequestPolicyState? state, CustomResourceOptions? opts = null)
public static OriginRequestPolicy get(String name, Output<String> id, OriginRequestPolicyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Comment string

Comment to describe the origin request policy.

CookiesConfig OriginRequestPolicyCookiesConfigArgs

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

Etag string

The current version of the origin request policy.

HeadersConfig OriginRequestPolicyHeadersConfigArgs

Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

Name string

Unique name to identify the origin request policy.

QueryStringsConfig OriginRequestPolicyQueryStringsConfigArgs

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

Comment string

Comment to describe the origin request policy.

CookiesConfig OriginRequestPolicyCookiesConfigArgs

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

Etag string

The current version of the origin request policy.

HeadersConfig OriginRequestPolicyHeadersConfigArgs

Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

Name string

Unique name to identify the origin request policy.

QueryStringsConfig OriginRequestPolicyQueryStringsConfigArgs

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

comment String

Comment to describe the origin request policy.

cookiesConfig OriginRequestPolicyCookiesConfigArgs

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

etag String

The current version of the origin request policy.

headersConfig OriginRequestPolicyHeadersConfigArgs

Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

name String

Unique name to identify the origin request policy.

queryStringsConfig OriginRequestPolicyQueryStringsConfigArgs

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

comment string

Comment to describe the origin request policy.

cookiesConfig OriginRequestPolicyCookiesConfigArgs

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

etag string

The current version of the origin request policy.

headersConfig OriginRequestPolicyHeadersConfigArgs

Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

name string

Unique name to identify the origin request policy.

queryStringsConfig OriginRequestPolicyQueryStringsConfigArgs

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

comment str

Comment to describe the origin request policy.

cookies_config OriginRequestPolicyCookiesConfigArgs

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

etag str

The current version of the origin request policy.

headers_config OriginRequestPolicyHeadersConfigArgs

Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

name str

Unique name to identify the origin request policy.

query_strings_config OriginRequestPolicyQueryStringsConfigArgs

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

comment String

Comment to describe the origin request policy.

cookiesConfig Property Map

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

etag String

The current version of the origin request policy.

headersConfig Property Map

Object that determines whether any HTTP headers (and if so, which headers) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

name String

Unique name to identify the origin request policy.

queryStringsConfig Property Map

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the origin request key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

Supporting Types

OriginRequestPolicyCookiesConfig

OriginRequestPolicyCookiesConfigCookies

Items List<string>
Items []string
items List<String>
items string[]
items Sequence[str]
items List<String>

OriginRequestPolicyHeadersConfig

OriginRequestPolicyHeadersConfigHeaders

Items List<string>
Items []string
items List<String>
items string[]
items Sequence[str]
items List<String>

OriginRequestPolicyQueryStringsConfig

OriginRequestPolicyQueryStringsConfigQueryStrings

Items List<string>
Items []string
items List<String>
items string[]
items Sequence[str]
items List<String>

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.