Represent origin shielding
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcore from "@pulumi/gcore";
const originGroup1 = new gcore.CdnOrigingroup("origin_group_1", {
name: "origin_group_1",
useNext: true,
origins: [{
source: "example.com",
enabled: true,
}],
});
const cdnExampleCom = new gcore.CdnResource("cdn_example_com", {
cname: "cdn.example.com",
originGroup: originGroup1.cdnOrigingroupId,
originProtocol: "MATCH",
secondaryHostnames: ["cdn2.example.com"],
options: {
edgeCacheSettings: {
"default": "8d",
},
browserCacheSettings: {
value: "1d",
},
redirectHttpToHttps: {
value: true,
},
requestLimiter: {
rateUnit: "r/s",
rate: 5,
burst: 1,
},
gzipOn: {
value: true,
},
cors: {
values: ["*"],
},
rewrite: {
body: "/(.*) /$1",
},
tlsVersions: {
enabled: true,
values: ["TLSv1.2"],
},
forceReturn: {
code: 200,
body: "OK",
},
},
});
const sl = gcore.getCdnShieldingLocation({
datacenter: "am3",
});
const originShielding1 = new gcore.CdnOriginshielding("origin_shielding_1", {
resourceId: cdnExampleCom.cdnResourceId,
shieldingPop: sl.then(sl => sl.id),
});
import pulumi
import pulumi_gcore as gcore
origin_group1 = gcore.CdnOrigingroup("origin_group_1",
name="origin_group_1",
use_next=True,
origins=[{
"source": "example.com",
"enabled": True,
}])
cdn_example_com = gcore.CdnResource("cdn_example_com",
cname="cdn.example.com",
origin_group=origin_group1.cdn_origingroup_id,
origin_protocol="MATCH",
secondary_hostnames=["cdn2.example.com"],
options={
"edge_cache_settings": {
"default": "8d",
},
"browser_cache_settings": {
"value": "1d",
},
"redirect_http_to_https": {
"value": True,
},
"request_limiter": {
"rate_unit": "r/s",
"rate": 5,
"burst": 1,
},
"gzip_on": {
"value": True,
},
"cors": {
"values": ["*"],
},
"rewrite": {
"body": "/(.*) /$1",
},
"tls_versions": {
"enabled": True,
"values": ["TLSv1.2"],
},
"force_return": {
"code": 200,
"body": "OK",
},
})
sl = gcore.get_cdn_shielding_location(datacenter="am3")
origin_shielding1 = gcore.CdnOriginshielding("origin_shielding_1",
resource_id=cdn_example_com.cdn_resource_id,
shielding_pop=sl.id)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
originGroup1, err := gcore.NewCdnOrigingroup(ctx, "origin_group_1", &gcore.CdnOrigingroupArgs{
Name: pulumi.String("origin_group_1"),
UseNext: pulumi.Bool(true),
Origins: gcore.CdnOrigingroupOriginArray{
&gcore.CdnOrigingroupOriginArgs{
Source: pulumi.String("example.com"),
Enabled: pulumi.Bool(true),
},
},
})
if err != nil {
return err
}
cdnExampleCom, err := gcore.NewCdnResource(ctx, "cdn_example_com", &gcore.CdnResourceArgs{
Cname: pulumi.String("cdn.example.com"),
OriginGroup: originGroup1.CdnOrigingroupId,
OriginProtocol: pulumi.String("MATCH"),
SecondaryHostnames: pulumi.StringArray{
pulumi.String("cdn2.example.com"),
},
Options: &gcore.CdnResourceOptionsArgs{
EdgeCacheSettings: &gcore.CdnResourceOptionsEdgeCacheSettingsArgs{
Default: pulumi.String("8d"),
},
BrowserCacheSettings: &gcore.CdnResourceOptionsBrowserCacheSettingsArgs{
Value: pulumi.String("1d"),
},
RedirectHttpToHttps: &gcore.CdnResourceOptionsRedirectHttpToHttpsArgs{
Value: pulumi.Bool(true),
},
RequestLimiter: &gcore.CdnResourceOptionsRequestLimiterArgs{
RateUnit: pulumi.String("r/s"),
Rate: pulumi.Float64(5),
Burst: pulumi.Float64(1),
},
GzipOn: &gcore.CdnResourceOptionsGzipOnArgs{
Value: pulumi.Bool(true),
},
Cors: &gcore.CdnResourceOptionsCorsArgs{
Values: pulumi.StringArray{
pulumi.String("*"),
},
},
Rewrite: &gcore.CdnResourceOptionsRewriteArgs{
Body: pulumi.String("/(.*) /$1"),
},
TlsVersions: &gcore.CdnResourceOptionsTlsVersionsArgs{
Enabled: pulumi.Bool(true),
Values: pulumi.StringArray{
pulumi.String("TLSv1.2"),
},
},
ForceReturn: &gcore.CdnResourceOptionsForceReturnArgs{
Code: pulumi.Float64(200),
Body: pulumi.String("OK"),
},
},
})
if err != nil {
return err
}
sl, err := gcore.GetCdnShieldingLocation(ctx, &gcore.GetCdnShieldingLocationArgs{
Datacenter: "am3",
}, nil)
if err != nil {
return err
}
_, err = gcore.NewCdnOriginshielding(ctx, "origin_shielding_1", &gcore.CdnOriginshieldingArgs{
ResourceId: cdnExampleCom.CdnResourceId,
ShieldingPop: pulumi.String(sl.Id),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcore = Pulumi.Gcore;
return await Deployment.RunAsync(() =>
{
var originGroup1 = new Gcore.CdnOrigingroup("origin_group_1", new()
{
Name = "origin_group_1",
UseNext = true,
Origins = new[]
{
new Gcore.Inputs.CdnOrigingroupOriginArgs
{
Source = "example.com",
Enabled = true,
},
},
});
var cdnExampleCom = new Gcore.CdnResource("cdn_example_com", new()
{
Cname = "cdn.example.com",
OriginGroup = originGroup1.CdnOrigingroupId,
OriginProtocol = "MATCH",
SecondaryHostnames = new[]
{
"cdn2.example.com",
},
Options = new Gcore.Inputs.CdnResourceOptionsArgs
{
EdgeCacheSettings = new Gcore.Inputs.CdnResourceOptionsEdgeCacheSettingsArgs
{
Default = "8d",
},
BrowserCacheSettings = new Gcore.Inputs.CdnResourceOptionsBrowserCacheSettingsArgs
{
Value = "1d",
},
RedirectHttpToHttps = new Gcore.Inputs.CdnResourceOptionsRedirectHttpToHttpsArgs
{
Value = true,
},
RequestLimiter = new Gcore.Inputs.CdnResourceOptionsRequestLimiterArgs
{
RateUnit = "r/s",
Rate = 5,
Burst = 1,
},
GzipOn = new Gcore.Inputs.CdnResourceOptionsGzipOnArgs
{
Value = true,
},
Cors = new Gcore.Inputs.CdnResourceOptionsCorsArgs
{
Values = new[]
{
"*",
},
},
Rewrite = new Gcore.Inputs.CdnResourceOptionsRewriteArgs
{
Body = "/(.*) /$1",
},
TlsVersions = new Gcore.Inputs.CdnResourceOptionsTlsVersionsArgs
{
Enabled = true,
Values = new[]
{
"TLSv1.2",
},
},
ForceReturn = new Gcore.Inputs.CdnResourceOptionsForceReturnArgs
{
Code = 200,
Body = "OK",
},
},
});
var sl = Gcore.GetCdnShieldingLocation.Invoke(new()
{
Datacenter = "am3",
});
var originShielding1 = new Gcore.CdnOriginshielding("origin_shielding_1", new()
{
ResourceId = cdnExampleCom.CdnResourceId,
ShieldingPop = sl.Apply(getCdnShieldingLocationResult => getCdnShieldingLocationResult.Id),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcore.CdnOrigingroup;
import com.pulumi.gcore.CdnOrigingroupArgs;
import com.pulumi.gcore.inputs.CdnOrigingroupOriginArgs;
import com.pulumi.gcore.CdnResource;
import com.pulumi.gcore.CdnResourceArgs;
import com.pulumi.gcore.inputs.CdnResourceOptionsArgs;
import com.pulumi.gcore.inputs.CdnResourceOptionsEdgeCacheSettingsArgs;
import com.pulumi.gcore.inputs.CdnResourceOptionsBrowserCacheSettingsArgs;
import com.pulumi.gcore.inputs.CdnResourceOptionsRedirectHttpToHttpsArgs;
import com.pulumi.gcore.inputs.CdnResourceOptionsRequestLimiterArgs;
import com.pulumi.gcore.inputs.CdnResourceOptionsGzipOnArgs;
import com.pulumi.gcore.inputs.CdnResourceOptionsCorsArgs;
import com.pulumi.gcore.inputs.CdnResourceOptionsRewriteArgs;
import com.pulumi.gcore.inputs.CdnResourceOptionsTlsVersionsArgs;
import com.pulumi.gcore.inputs.CdnResourceOptionsForceReturnArgs;
import com.pulumi.gcore.GcoreFunctions;
import com.pulumi.gcore.inputs.GetCdnShieldingLocationArgs;
import com.pulumi.gcore.CdnOriginshielding;
import com.pulumi.gcore.CdnOriginshieldingArgs;
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 originGroup1 = new CdnOrigingroup("originGroup1", CdnOrigingroupArgs.builder()
.name("origin_group_1")
.useNext(true)
.origins(CdnOrigingroupOriginArgs.builder()
.source("example.com")
.enabled(true)
.build())
.build());
var cdnExampleCom = new CdnResource("cdnExampleCom", CdnResourceArgs.builder()
.cname("cdn.example.com")
.originGroup(originGroup1.cdnOrigingroupId())
.originProtocol("MATCH")
.secondaryHostnames("cdn2.example.com")
.options(CdnResourceOptionsArgs.builder()
.edgeCacheSettings(CdnResourceOptionsEdgeCacheSettingsArgs.builder()
.default_("8d")
.build())
.browserCacheSettings(CdnResourceOptionsBrowserCacheSettingsArgs.builder()
.value("1d")
.build())
.redirectHttpToHttps(CdnResourceOptionsRedirectHttpToHttpsArgs.builder()
.value(true)
.build())
.requestLimiter(CdnResourceOptionsRequestLimiterArgs.builder()
.rateUnit("r/s")
.rate(5.0)
.burst(1.0)
.build())
.gzipOn(CdnResourceOptionsGzipOnArgs.builder()
.value(true)
.build())
.cors(CdnResourceOptionsCorsArgs.builder()
.values("*")
.build())
.rewrite(CdnResourceOptionsRewriteArgs.builder()
.body("/(.*) /$1")
.build())
.tlsVersions(CdnResourceOptionsTlsVersionsArgs.builder()
.enabled(true)
.values("TLSv1.2")
.build())
.forceReturn(CdnResourceOptionsForceReturnArgs.builder()
.code(200.0)
.body("OK")
.build())
.build())
.build());
final var sl = GcoreFunctions.getCdnShieldingLocation(GetCdnShieldingLocationArgs.builder()
.datacenter("am3")
.build());
var originShielding1 = new CdnOriginshielding("originShielding1", CdnOriginshieldingArgs.builder()
.resourceId(cdnExampleCom.cdnResourceId())
.shieldingPop(sl.id())
.build());
}
}
resources:
originGroup1:
type: gcore:CdnOrigingroup
name: origin_group_1
properties:
name: origin_group_1
useNext: true
origins:
- source: example.com
enabled: true
cdnExampleCom:
type: gcore:CdnResource
name: cdn_example_com
properties:
cname: cdn.example.com
originGroup: ${originGroup1.cdnOrigingroupId}
originProtocol: MATCH
secondaryHostnames:
- cdn2.example.com
options:
edgeCacheSettings:
default: 8d
browserCacheSettings:
value: 1d
redirectHttpToHttps:
value: true
requestLimiter:
rateUnit: r/s
rate: 5
burst: 1
gzipOn:
value: true
cors:
values:
- '*'
rewrite:
body: /(.*) /$1
tlsVersions:
enabled: true
values:
- TLSv1.2
forceReturn:
code: 200
body: OK
originShielding1:
type: gcore:CdnOriginshielding
name: origin_shielding_1
properties:
resourceId: ${cdnExampleCom.cdnResourceId}
shieldingPop: ${sl.id}
variables:
sl:
fn::invoke:
function: gcore:getCdnShieldingLocation
arguments:
datacenter: am3
Create CdnOriginshielding Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CdnOriginshielding(name: string, args: CdnOriginshieldingArgs, opts?: CustomResourceOptions);@overload
def CdnOriginshielding(resource_name: str,
args: CdnOriginshieldingArgs,
opts: Optional[ResourceOptions] = None)
@overload
def CdnOriginshielding(resource_name: str,
opts: Optional[ResourceOptions] = None,
resource_id: Optional[float] = None,
shielding_pop: Optional[float] = None,
cdn_originshielding_id: Optional[str] = None)func NewCdnOriginshielding(ctx *Context, name string, args CdnOriginshieldingArgs, opts ...ResourceOption) (*CdnOriginshielding, error)public CdnOriginshielding(string name, CdnOriginshieldingArgs args, CustomResourceOptions? opts = null)
public CdnOriginshielding(String name, CdnOriginshieldingArgs args)
public CdnOriginshielding(String name, CdnOriginshieldingArgs args, CustomResourceOptions options)
type: gcore:CdnOriginshielding
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 CdnOriginshieldingArgs
- 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 CdnOriginshieldingArgs
- 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 CdnOriginshieldingArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CdnOriginshieldingArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CdnOriginshieldingArgs
- 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 cdnOriginshieldingResource = new Gcore.CdnOriginshielding("cdnOriginshieldingResource", new()
{
ResourceId = 0,
ShieldingPop = 0,
CdnOriginshieldingId = "string",
});
example, err := gcore.NewCdnOriginshielding(ctx, "cdnOriginshieldingResource", &gcore.CdnOriginshieldingArgs{
ResourceId: pulumi.Float64(0),
ShieldingPop: pulumi.Float64(0),
CdnOriginshieldingId: pulumi.String("string"),
})
var cdnOriginshieldingResource = new CdnOriginshielding("cdnOriginshieldingResource", CdnOriginshieldingArgs.builder()
.resourceId(0.0)
.shieldingPop(0.0)
.cdnOriginshieldingId("string")
.build());
cdn_originshielding_resource = gcore.CdnOriginshielding("cdnOriginshieldingResource",
resource_id=0,
shielding_pop=0,
cdn_originshielding_id="string")
const cdnOriginshieldingResource = new gcore.CdnOriginshielding("cdnOriginshieldingResource", {
resourceId: 0,
shieldingPop: 0,
cdnOriginshieldingId: "string",
});
type: gcore:CdnOriginshielding
properties:
cdnOriginshieldingId: string
resourceId: 0
shieldingPop: 0
CdnOriginshielding Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The CdnOriginshielding resource accepts the following input properties:
- Resource
Id double - ID of CDN resource for which shielding will be applied
- Shielding
Pop double - ID of the shielding point of present
- Cdn
Originshielding stringId - The ID of this resource.
- Resource
Id float64 - ID of CDN resource for which shielding will be applied
- Shielding
Pop float64 - ID of the shielding point of present
- Cdn
Originshielding stringId - The ID of this resource.
- resource
Id Double - ID of CDN resource for which shielding will be applied
- shielding
Pop Double - ID of the shielding point of present
- cdn
Originshielding StringId - The ID of this resource.
- resource
Id number - ID of CDN resource for which shielding will be applied
- shielding
Pop number - ID of the shielding point of present
- cdn
Originshielding stringId - The ID of this resource.
- resource_
id float - ID of CDN resource for which shielding will be applied
- shielding_
pop float - ID of the shielding point of present
- cdn_
originshielding_ strid - The ID of this resource.
- resource
Id Number - ID of CDN resource for which shielding will be applied
- shielding
Pop Number - ID of the shielding point of present
- cdn
Originshielding StringId - The ID of this resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the CdnOriginshielding 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 CdnOriginshielding Resource
Get an existing CdnOriginshielding 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?: CdnOriginshieldingState, opts?: CustomResourceOptions): CdnOriginshielding@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
cdn_originshielding_id: Optional[str] = None,
resource_id: Optional[float] = None,
shielding_pop: Optional[float] = None) -> CdnOriginshieldingfunc GetCdnOriginshielding(ctx *Context, name string, id IDInput, state *CdnOriginshieldingState, opts ...ResourceOption) (*CdnOriginshielding, error)public static CdnOriginshielding Get(string name, Input<string> id, CdnOriginshieldingState? state, CustomResourceOptions? opts = null)public static CdnOriginshielding get(String name, Output<String> id, CdnOriginshieldingState state, CustomResourceOptions options)resources: _: type: gcore:CdnOriginshielding get: id: ${id}- 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.
- Cdn
Originshielding stringId - The ID of this resource.
- Resource
Id double - ID of CDN resource for which shielding will be applied
- Shielding
Pop double - ID of the shielding point of present
- Cdn
Originshielding stringId - The ID of this resource.
- Resource
Id float64 - ID of CDN resource for which shielding will be applied
- Shielding
Pop float64 - ID of the shielding point of present
- cdn
Originshielding StringId - The ID of this resource.
- resource
Id Double - ID of CDN resource for which shielding will be applied
- shielding
Pop Double - ID of the shielding point of present
- cdn
Originshielding stringId - The ID of this resource.
- resource
Id number - ID of CDN resource for which shielding will be applied
- shielding
Pop number - ID of the shielding point of present
- cdn_
originshielding_ strid - The ID of this resource.
- resource_
id float - ID of CDN resource for which shielding will be applied
- shielding_
pop float - ID of the shielding point of present
- cdn
Originshielding StringId - The ID of this resource.
- resource
Id Number - ID of CDN resource for which shielding will be applied
- shielding
Pop Number - ID of the shielding point of present
Package Details
- Repository
- gcore g-core/terraform-provider-gcore
- License
- Notes
- This Pulumi package is based on the
gcoreTerraform Provider.
