1. Packages
  2. Cloudflare
  3. API Docs
  4. ManagedHeaders
Cloudflare v5.33.1 published on Wednesday, Jun 26, 2024 by Pulumi

cloudflare.ManagedHeaders

Explore with Pulumi AI

cloudflare logo
Cloudflare v5.33.1 published on Wednesday, Jun 26, 2024 by Pulumi

    The Cloudflare Managed Headers allows you to add or remove some predefined headers to one’s requests or origin responses.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    
    // Enable security headers using Managed Meaders
    const example = new cloudflare.ManagedHeaders("example", {
        zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
        managedRequestHeaders: [{
            id: "add_true_client_ip_headers",
            enabled: true,
        }],
        managedResponseHeaders: [{
            id: "remove_x-powered-by_header",
            enabled: true,
        }],
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    # Enable security headers using Managed Meaders
    example = cloudflare.ManagedHeaders("example",
        zone_id="0da42c8d2132a9ddaf714f9e7c920711",
        managed_request_headers=[cloudflare.ManagedHeadersManagedRequestHeaderArgs(
            id="add_true_client_ip_headers",
            enabled=True,
        )],
        managed_response_headers=[cloudflare.ManagedHeadersManagedResponseHeaderArgs(
            id="remove_x-powered-by_header",
            enabled=True,
        )])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Enable security headers using Managed Meaders
    		_, err := cloudflare.NewManagedHeaders(ctx, "example", &cloudflare.ManagedHeadersArgs{
    			ZoneId: pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
    			ManagedRequestHeaders: cloudflare.ManagedHeadersManagedRequestHeaderArray{
    				&cloudflare.ManagedHeadersManagedRequestHeaderArgs{
    					Id:      pulumi.String("add_true_client_ip_headers"),
    					Enabled: pulumi.Bool(true),
    				},
    			},
    			ManagedResponseHeaders: cloudflare.ManagedHeadersManagedResponseHeaderArray{
    				&cloudflare.ManagedHeadersManagedResponseHeaderArgs{
    					Id:      pulumi.String("remove_x-powered-by_header"),
    					Enabled: pulumi.Bool(true),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cloudflare = Pulumi.Cloudflare;
    
    return await Deployment.RunAsync(() => 
    {
        // Enable security headers using Managed Meaders
        var example = new Cloudflare.ManagedHeaders("example", new()
        {
            ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
            ManagedRequestHeaders = new[]
            {
                new Cloudflare.Inputs.ManagedHeadersManagedRequestHeaderArgs
                {
                    Id = "add_true_client_ip_headers",
                    Enabled = true,
                },
            },
            ManagedResponseHeaders = new[]
            {
                new Cloudflare.Inputs.ManagedHeadersManagedResponseHeaderArgs
                {
                    Id = "remove_x-powered-by_header",
                    Enabled = true,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.ManagedHeaders;
    import com.pulumi.cloudflare.ManagedHeadersArgs;
    import com.pulumi.cloudflare.inputs.ManagedHeadersManagedRequestHeaderArgs;
    import com.pulumi.cloudflare.inputs.ManagedHeadersManagedResponseHeaderArgs;
    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) {
            // Enable security headers using Managed Meaders
            var example = new ManagedHeaders("example", ManagedHeadersArgs.builder()
                .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
                .managedRequestHeaders(ManagedHeadersManagedRequestHeaderArgs.builder()
                    .id("add_true_client_ip_headers")
                    .enabled(true)
                    .build())
                .managedResponseHeaders(ManagedHeadersManagedResponseHeaderArgs.builder()
                    .id("remove_x-powered-by_header")
                    .enabled(true)
                    .build())
                .build());
    
        }
    }
    
    resources:
      # Enable security headers using Managed Meaders
      example:
        type: cloudflare:ManagedHeaders
        properties:
          zoneId: 0da42c8d2132a9ddaf714f9e7c920711
          managedRequestHeaders:
            - id: add_true_client_ip_headers
              enabled: true
          managedResponseHeaders:
            - id: remove_x-powered-by_header
              enabled: true
    

    Create ManagedHeaders Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ManagedHeaders(name: string, args: ManagedHeadersArgs, opts?: CustomResourceOptions);
    @overload
    def ManagedHeaders(resource_name: str,
                       args: ManagedHeadersArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def ManagedHeaders(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       zone_id: Optional[str] = None,
                       managed_request_headers: Optional[Sequence[ManagedHeadersManagedRequestHeaderArgs]] = None,
                       managed_response_headers: Optional[Sequence[ManagedHeadersManagedResponseHeaderArgs]] = None)
    func NewManagedHeaders(ctx *Context, name string, args ManagedHeadersArgs, opts ...ResourceOption) (*ManagedHeaders, error)
    public ManagedHeaders(string name, ManagedHeadersArgs args, CustomResourceOptions? opts = null)
    public ManagedHeaders(String name, ManagedHeadersArgs args)
    public ManagedHeaders(String name, ManagedHeadersArgs args, CustomResourceOptions options)
    
    type: cloudflare:ManagedHeaders
    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 ManagedHeadersArgs
    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 ManagedHeadersArgs
    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 ManagedHeadersArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ManagedHeadersArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ManagedHeadersArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var managedHeadersResource = new Cloudflare.ManagedHeaders("managedHeadersResource", new()
    {
        ZoneId = "string",
        ManagedRequestHeaders = new[]
        {
            new Cloudflare.Inputs.ManagedHeadersManagedRequestHeaderArgs
            {
                Enabled = false,
                Id = "string",
            },
        },
        ManagedResponseHeaders = new[]
        {
            new Cloudflare.Inputs.ManagedHeadersManagedResponseHeaderArgs
            {
                Enabled = false,
                Id = "string",
            },
        },
    });
    
    example, err := cloudflare.NewManagedHeaders(ctx, "managedHeadersResource", &cloudflare.ManagedHeadersArgs{
    	ZoneId: pulumi.String("string"),
    	ManagedRequestHeaders: cloudflare.ManagedHeadersManagedRequestHeaderArray{
    		&cloudflare.ManagedHeadersManagedRequestHeaderArgs{
    			Enabled: pulumi.Bool(false),
    			Id:      pulumi.String("string"),
    		},
    	},
    	ManagedResponseHeaders: cloudflare.ManagedHeadersManagedResponseHeaderArray{
    		&cloudflare.ManagedHeadersManagedResponseHeaderArgs{
    			Enabled: pulumi.Bool(false),
    			Id:      pulumi.String("string"),
    		},
    	},
    })
    
    var managedHeadersResource = new ManagedHeaders("managedHeadersResource", ManagedHeadersArgs.builder()
        .zoneId("string")
        .managedRequestHeaders(ManagedHeadersManagedRequestHeaderArgs.builder()
            .enabled(false)
            .id("string")
            .build())
        .managedResponseHeaders(ManagedHeadersManagedResponseHeaderArgs.builder()
            .enabled(false)
            .id("string")
            .build())
        .build());
    
    managed_headers_resource = cloudflare.ManagedHeaders("managedHeadersResource",
        zone_id="string",
        managed_request_headers=[cloudflare.ManagedHeadersManagedRequestHeaderArgs(
            enabled=False,
            id="string",
        )],
        managed_response_headers=[cloudflare.ManagedHeadersManagedResponseHeaderArgs(
            enabled=False,
            id="string",
        )])
    
    const managedHeadersResource = new cloudflare.ManagedHeaders("managedHeadersResource", {
        zoneId: "string",
        managedRequestHeaders: [{
            enabled: false,
            id: "string",
        }],
        managedResponseHeaders: [{
            enabled: false,
            id: "string",
        }],
    });
    
    type: cloudflare:ManagedHeaders
    properties:
        managedRequestHeaders:
            - enabled: false
              id: string
        managedResponseHeaders:
            - enabled: false
              id: string
        zoneId: string
    

    ManagedHeaders 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 ManagedHeaders resource accepts the following input properties:

    ZoneId string
    The zone identifier to target for the resource.
    ManagedRequestHeaders List<ManagedHeadersManagedRequestHeader>
    The list of managed request headers.
    ManagedResponseHeaders List<ManagedHeadersManagedResponseHeader>
    The list of managed response headers.
    ZoneId string
    The zone identifier to target for the resource.
    ManagedRequestHeaders []ManagedHeadersManagedRequestHeaderArgs
    The list of managed request headers.
    ManagedResponseHeaders []ManagedHeadersManagedResponseHeaderArgs
    The list of managed response headers.
    zoneId String
    The zone identifier to target for the resource.
    managedRequestHeaders List<ManagedHeadersManagedRequestHeader>
    The list of managed request headers.
    managedResponseHeaders List<ManagedHeadersManagedResponseHeader>
    The list of managed response headers.
    zoneId string
    The zone identifier to target for the resource.
    managedRequestHeaders ManagedHeadersManagedRequestHeader[]
    The list of managed request headers.
    managedResponseHeaders ManagedHeadersManagedResponseHeader[]
    The list of managed response headers.
    zone_id str
    The zone identifier to target for the resource.
    managed_request_headers Sequence[ManagedHeadersManagedRequestHeaderArgs]
    The list of managed request headers.
    managed_response_headers Sequence[ManagedHeadersManagedResponseHeaderArgs]
    The list of managed response headers.
    zoneId String
    The zone identifier to target for the resource.
    managedRequestHeaders List<Property Map>
    The list of managed request headers.
    managedResponseHeaders List<Property Map>
    The list of managed response headers.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ManagedHeaders Resource

    Get an existing ManagedHeaders 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?: ManagedHeadersState, opts?: CustomResourceOptions): ManagedHeaders
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            managed_request_headers: Optional[Sequence[ManagedHeadersManagedRequestHeaderArgs]] = None,
            managed_response_headers: Optional[Sequence[ManagedHeadersManagedResponseHeaderArgs]] = None,
            zone_id: Optional[str] = None) -> ManagedHeaders
    func GetManagedHeaders(ctx *Context, name string, id IDInput, state *ManagedHeadersState, opts ...ResourceOption) (*ManagedHeaders, error)
    public static ManagedHeaders Get(string name, Input<string> id, ManagedHeadersState? state, CustomResourceOptions? opts = null)
    public static ManagedHeaders get(String name, Output<String> id, ManagedHeadersState 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:
    ManagedRequestHeaders List<ManagedHeadersManagedRequestHeader>
    The list of managed request headers.
    ManagedResponseHeaders List<ManagedHeadersManagedResponseHeader>
    The list of managed response headers.
    ZoneId string
    The zone identifier to target for the resource.
    ManagedRequestHeaders []ManagedHeadersManagedRequestHeaderArgs
    The list of managed request headers.
    ManagedResponseHeaders []ManagedHeadersManagedResponseHeaderArgs
    The list of managed response headers.
    ZoneId string
    The zone identifier to target for the resource.
    managedRequestHeaders List<ManagedHeadersManagedRequestHeader>
    The list of managed request headers.
    managedResponseHeaders List<ManagedHeadersManagedResponseHeader>
    The list of managed response headers.
    zoneId String
    The zone identifier to target for the resource.
    managedRequestHeaders ManagedHeadersManagedRequestHeader[]
    The list of managed request headers.
    managedResponseHeaders ManagedHeadersManagedResponseHeader[]
    The list of managed response headers.
    zoneId string
    The zone identifier to target for the resource.
    managed_request_headers Sequence[ManagedHeadersManagedRequestHeaderArgs]
    The list of managed request headers.
    managed_response_headers Sequence[ManagedHeadersManagedResponseHeaderArgs]
    The list of managed response headers.
    zone_id str
    The zone identifier to target for the resource.
    managedRequestHeaders List<Property Map>
    The list of managed request headers.
    managedResponseHeaders List<Property Map>
    The list of managed response headers.
    zoneId String
    The zone identifier to target for the resource.

    Supporting Types

    ManagedHeadersManagedRequestHeader, ManagedHeadersManagedRequestHeaderArgs

    Enabled bool
    Whether the headers rule is active.
    Id string
    Unique headers rule identifier.
    Enabled bool
    Whether the headers rule is active.
    Id string
    Unique headers rule identifier.
    enabled Boolean
    Whether the headers rule is active.
    id String
    Unique headers rule identifier.
    enabled boolean
    Whether the headers rule is active.
    id string
    Unique headers rule identifier.
    enabled bool
    Whether the headers rule is active.
    id str
    Unique headers rule identifier.
    enabled Boolean
    Whether the headers rule is active.
    id String
    Unique headers rule identifier.

    ManagedHeadersManagedResponseHeader, ManagedHeadersManagedResponseHeaderArgs

    Enabled bool
    Whether the headers rule is active.
    Id string
    Unique headers rule identifier.
    Enabled bool
    Whether the headers rule is active.
    Id string
    Unique headers rule identifier.
    enabled Boolean
    Whether the headers rule is active.
    id String
    Unique headers rule identifier.
    enabled boolean
    Whether the headers rule is active.
    id string
    Unique headers rule identifier.
    enabled bool
    Whether the headers rule is active.
    id str
    Unique headers rule identifier.
    enabled Boolean
    Whether the headers rule is active.
    id String
    Unique headers rule identifier.

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v5.33.1 published on Wednesday, Jun 26, 2024 by Pulumi