azurermCdnEndpoint
A CDN Endpoint is the entity within a CDN Profile containing configuration information regarding caching behaviours and origins. The CDN Endpoint is exposed using the URL format <endpointname>AzureedgeNet
.
!> Be Aware: Azure is rolling out a breaking change on Friday 9th April 2021 which may cause issues with the CDN/FrontDoor resources. More information is available in this GitHub issue - however unfortunately this may necessitate a breaking change to the CDN and FrontDoor resources, more information will be posted in the GitHub issue as the necessary changes are identified.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "example-resources",
}
);
const azurermCdnProfileExample = new azurerm.cdnProfile.CdnProfile(
this,
"example_1",
{
location: azurermResourceGroupExample.location,
name: "example-cdn",
resource_group_name: azurermResourceGroupExample.name,
sku: "Standard_Verizon",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermCdnProfileExample.overrideLogicalId("example");
const azurermCdnEndpointExample = new azurerm.cdnEndpoint.CdnEndpoint(
this,
"example_2",
{
location: azurermResourceGroupExample.location,
name: "example",
origin: [
{
host_name: "www.contoso.com",
name: "example",
},
],
profile_name: azurermCdnProfileExample.name,
resource_group_name: azurermResourceGroupExample.name,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermCdnEndpointExample.overrideLogicalId("example");
Arguments Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the CDN Endpoint. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) The name of the resource group in which to create the CDN Endpoint. Changing this forces a new resource to be created. -
profileName
- (Required) The CDN Profile to which to attach the CDN Endpoint. Changing this forces a new resource to be created. -
location
- (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -
isHttpAllowed
- (Optional) Defaults totrue
. -
isHttpsAllowed
- (Optional) Defaults totrue
. -
contentTypesToCompress
- (Optional) An array of strings that indicates a content types on which compression will be applied. The value for the elements should be MIME types. -
geoFilter
- (Optional) A set of Geo Filters for this CDN Endpoint. EachgeoFilter
block supports fields documented below. -
isCompressionEnabled
- (Optional) Indicates whether compression is to be enabled. -
querystringCachingBehaviour
- (Optional) Sets query string caching behavior. Allowed values areignoreQueryString
,bypassCaching
anduseQueryString
.notSet
value can be used forpremiumVerizon
CDN profile. Defaults toignoreQueryString
. -
optimizationType
- (Optional) What types of optimization should this CDN Endpoint optimize for? Possible values includedynamicSiteAcceleration
,generalMediaStreaming
,generalWebDelivery
,largeFileDownload
andvideoOnDemandMediaStreaming
. -
origin
- (Required) The set of origins of the CDN endpoint. When multiple origins exist, the first origin will be used as primary and rest will be used as failover options. Eachorigin
block supports fields documented below. Changing this forces a new resource to be created. -
originHostHeader
- (Optional) The host header CDN provider will send along with content requests to origins. -
originPath
- (Optional) The path used at for origin requests. -
probePath
- (Optional) the path to a file hosted on the origin which helps accelerate delivery of the dynamic content and calculate the most optimal routes for the CDN. This is relative to theoriginPath
.
-> NOTE: globalDeliveryRule
and deliveryRule
are currently only available for microsoftStandard
CDN profiles.
-
globalDeliveryRule
- (Optional) Actions that are valid for all resources regardless of any conditions. AglobalDeliveryRule
block as defined below. -
deliveryRule
- (Optional) Rules for the rules engine. An endpoint can contain up until 4 of those rules that consist of conditions and actions. AdeliveryRule
blocks as defined below. -
tags
- (Optional) A mapping of tags to assign to the resource.
The origin
block supports:
-
name
- (Required) The name of the origin. This is an arbitrary value. However, this value needs to be unique under the endpoint. Changing this forces a new resource to be created. -
hostName
- (Required) A string that determines the hostname/IP address of the origin server. This string can be a domain name, Storage Account endpoint, Web App endpoint, IPv4 address or IPv6 address. Changing this forces a new resource to be created. -
httpPort
- (Optional) The HTTP port of the origin. Defaults to80
. Changing this forces a new resource to be created. -
httpsPort
- (Optional) The HTTPS port of the origin. Defaults to443
. Changing this forces a new resource to be created.
The geoFilter
block supports:
-
relativePath
- (Required) The relative path applicable to geo filter. -
action
- (Required) The Action of the Geo Filter. Possible values includeallow
andblock
. -
countryCodes
- (Required) A List of two letter country codes (e.g.us
,gb
) to be associated with this Geo Filter.
A globalDeliveryRule
block supports the following:
-
cacheExpirationAction
- (Optional) AcacheExpirationAction
block as defined above. -
cacheKeyQueryStringAction
- (Optional) AcacheKeyQueryStringAction
block as defined above. -
modifyRequestHeaderAction
- (Optional) AmodifyRequestHeaderAction
block as defined below. -
modifyResponseHeaderAction
- (Optional) AmodifyResponseHeaderAction
block as defined below. -
urlRedirectAction
- (Optional) AurlRedirectAction
block as defined below. -
urlRewriteAction
- (Optional) AurlRewriteAction
block as defined below.
A deliveryRule
block supports the following:
-
name
- (Required) The Name which should be used for this Delivery Rule. -
order
- (Required) The order used for this rule. The order values should be sequential and begin at1
. -
cacheExpirationAction
- (Optional) AcacheExpirationAction
block as defined above. -
cacheKeyQueryStringAction
- (Optional) AcacheKeyQueryStringAction
block as defined above. -
cookiesCondition
- (Optional) AcookiesCondition
block as defined above. -
deviceCondition
- (Optional) AdeviceCondition
block as defined below. -
httpVersionCondition
- (Optional) AhttpVersionCondition
block as defined below. -
modifyRequestHeaderAction
- (Optional) AmodifyRequestHeaderAction
block as defined below. -
modifyResponseHeaderAction
- (Optional) AmodifyResponseHeaderAction
block as defined below. -
postArgCondition
- (Optional) ApostArgCondition
block as defined below. -
queryStringCondition
- (Optional) AqueryStringCondition
block as defined below. -
remoteAddressCondition
- (Optional) AremoteAddressCondition
block as defined below. -
requestBodyCondition
- (Optional) ArequestBodyCondition
block as defined below. -
requestHeaderCondition
- (Optional) ArequestHeaderCondition
block as defined below. -
requestMethodCondition
- (Optional) ArequestMethodCondition
block as defined below. -
requestSchemeCondition
- (Optional) ArequestSchemeCondition
block as defined below. -
requestUriCondition
- (Optional) ArequestUriCondition
block as defined below. -
urlFileExtensionCondition
- (Optional) AurlFileExtensionCondition
block as defined below. -
urlFileNameCondition
- (Optional) AurlFileNameCondition
block as defined below. -
urlPathCondition
- (Optional) AurlPathCondition
block as defined below. -
urlRedirectAction
- (Optional) AurlRedirectAction
block as defined below. -
urlRewriteAction
- (Optional) AurlRewriteAction
block as defined below.
A cacheExpirationAction
block supports the following:
-
behavior
- (Required) The behavior of the cache. Valid values arebypassCache
,override
andsetIfMissing
. -
duration
- (Optional) Duration of the cache. Only allowed whenbehavior
is set tooverride
orsetIfMissing
. Format:[d.]hh:mm:ss
A cacheKeyQueryStringAction
block supports the following:
-
behavior
- (Required) The behavior of the cache key for query strings. Valid values areexclude
,excludeAll
,include
andincludeAll
. -
parameters
- (Optional) Comma separated list of parameter values.
A modifyRequestHeaderAction
block supports the following:
-
action
- (Required) Action to be executed on a header value. Valid values areappend
,delete
andoverwrite
. -
name
- (Required) The header name. -
value
- (Optional) The value of the header. Only needed whenaction
is set toappend
oroverwrite
.
A modifyResponseHeaderAction
block supports the following:
-
action
- (Required) Action to be executed on a header value. Valid values areappend
,delete
andoverwrite
. -
name
- (Required) The header name. -
value
- (Optional) The value of the header. Only needed whenaction
is set toappend
oroverwrite
.
A urlRedirectAction
block supports the following:
-
redirectType
- (Required) Type of the redirect. Valid values arefound
,moved
,permanentRedirect
andtemporaryRedirect
. -
protocol
- (Optional) Specifies the protocol part of the URL. Valid values arematchRequest
,http
andhttps
. -
hostname
- (Optional) Specifies the hostname part of the URL. -
path
- (Optional) Specifies the path part of the URL. This value must begin with a/
. -
fragment
- (Optional) Specifies the fragment part of the URL. This value must not start with a#
. -
queryString
- (Optional) Specifies the query string part of the URL. This value must not start with a?
or&
and must be in<key>=<value>
format separated by&
.
A urlRewriteAction
block supports the following:
-
sourcePattern
- (Required) This value must start with a/
and can't be longer than 260 characters. -
destination
- (Required) This value must start with a/
and can't be longer than 260 characters. -
preserveUnmatchedPath
- (Optional) Defaults totrue
.
A cookiesCondition
block supports the following:
-
selector
- (Required) Name of the cookie. -
operator
- (Required) Valid values areany
,beginsWith
,contains
,endsWith
,equal
,greaterThan
,greaterThanOrEqual
,lessThan
andlessThanOrEqual
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Optional) List of values for the cookie. This is required ifoperator
is notany
. -
transforms
- (Optional) A list of transforms. Valid values arelowercase
anduppercase
.
A deviceCondition
block supports the following:
-
operator
- (Optional) Valid values areequal
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Required) Valid values aredesktop
andmobile
.
A httpVersionCondition
block supports the following:
-
operator
- (Optional) Valid values areequal
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Required) Valid values are09
,10
,11
and20
.
A postArgCondition
block supports the following:
-
selector
- (Required) Name of the post arg. -
operator
- (Required) Valid values areany
,beginsWith
,contains
,endsWith
,equal
,greaterThan
,greaterThanOrEqual
,lessThan
andlessThanOrEqual
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Optional) List of string values. This is required ifoperator
is notany
. -
transforms
- (Optional) A list of transforms. Valid values arelowercase
anduppercase
.
A queryStringCondition
block supports the following:
-
operator
- (Required) Valid values areany
,beginsWith
,contains
,endsWith
,equal
,greaterThan
,greaterThanOrEqual
,lessThan
andlessThanOrEqual
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Optional) List of string values. This is required ifoperator
is notany
. -
transforms
- (Optional) A list of transforms. Valid values arelowercase
anduppercase
.
A remoteAddressCondition
block supports the following:
-
operator
- (Required) Valid values areany
,geoMatch
andipMatch
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Optional) List of string values. ForgeoMatch
operator
this should be a list of country codes (e.g.us
orde
). List of IP address ifoperator
equals toipMatch
. This is required ifoperator
is notany
.
A requestBodyCondition
block supports the following:
-
operator
- (Required) Valid values areany
,beginsWith
,contains
,endsWith
,equal
,greaterThan
,greaterThanOrEqual
,lessThan
andlessThanOrEqual
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Optional) List of string values. This is required ifoperator
is notany
. -
transforms
- (Optional) A list of transforms. Valid values arelowercase
anduppercase
.
A requestHeaderCondition
block supports the following:
-
selector
- (Required) Header name. -
operator
- (Required) Valid values areany
,beginsWith
,contains
,endsWith
,equal
,greaterThan
,greaterThanOrEqual
,lessThan
andlessThanOrEqual
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Optional) List of header values. This is required ifoperator
is notany
. -
transforms
- (Optional) A list of transforms. Valid values arelowercase
anduppercase
.
A requestMethodCondition
block supports the following:
-
operator
- (Optional) Valid values areequal
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Required) Valid values aredelete
,get
,head
,options
,post
andput
.
A requestSchemeCondition
block supports the following:
-
operator
- (Optional) Valid values areequal
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Required) Valid values arehttp
andhttps
.
A requestUriCondition
block supports the following:
-
operator
- (Required) Valid values areany
,beginsWith
,contains
,endsWith
,equal
,greaterThan
,greaterThanOrEqual
,lessThan
andlessThanOrEqual
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Optional) List of string values. This is required ifoperator
is notany
. -
transforms
- (Optional) A list of transforms. Valid values arelowercase
anduppercase
.
A urlFileExtensionCondition
block supports the following:
-
operator
- (Required) Valid values areany
,beginsWith
,contains
,endsWith
,equal
,greaterThan
,greaterThanOrEqual
,lessThan
andlessThanOrEqual
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Optional) List of string values. This is required ifoperator
is notany
. -
transforms
- (Optional) A list of transforms. Valid values arelowercase
anduppercase
.
A urlFileNameCondition
block supports the following:
-
operator
- (Required) Valid values areany
,beginsWith
,contains
,endsWith
,equal
,greaterThan
,greaterThanOrEqual
,lessThan
andlessThanOrEqual
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Optional) List of string values. This is required ifoperator
is notany
. -
transforms
- (Optional) A list of transforms. Valid values arelowercase
anduppercase
.
A urlPathCondition
block supports the following:
-
operator
- (Required) Valid values areany
,beginsWith
,contains
,endsWith
,equal
,greaterThan
,greaterThanOrEqual
,lessThan
,lessThanOrEqual
,regEx
andwildcard
. -
negateCondition
- (Optional) Defaults tofalse
. -
matchValues
- (Optional) List of string values. This is required ifoperator
is notany
. -
transforms
- (Optional) A list of transforms. Valid values arelowercase
anduppercase
.
Attributes Reference
The following attributes are exported:
-
id
- The ID of the CDN Endpoint. -
fqdn
- The Fully Qualified Domain Name of the CDN Endpoint.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the CDN Endpoint.update
- (Defaults to 30 minutes) Used when updating the CDN Endpoint.read
- (Defaults to 5 minutes) Used when retrieving the CDN Endpoint.delete
- (Defaults to 30 minutes) Used when deleting the CDN Endpoint.
Import
CDN Endpoints can be imported using the resourceId
, e.g.