1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. fc
  5. CustomDomain
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.fc.CustomDomain

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    Provides an Alicloud Function Compute custom domain resource. For the detailed information, please refer to the developer guide.

    NOTE: Available since v1.98.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const _default = new random.index.Integer("default", {
        max: 99999,
        min: 10000,
    });
    const defaultProject = new alicloud.log.Project("default", {name: `example-value-${_default.result}`});
    const defaultStore = new alicloud.log.Store("default", {
        project: defaultProject.name,
        name: "example-value",
    });
    const defaultRole = new alicloud.ram.Role("default", {
        name: `fcservicerole-${_default.result}`,
        document: `  {
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Effect": "Allow",
              "Principal": {
                "Service": [
                  "fc.aliyuncs.com"
                ]
              }
            }
          ],
          "Version": "1"
      }
    `,
        description: "this is a example",
        force: true,
    });
    const defaultRolePolicyAttachment = new alicloud.ram.RolePolicyAttachment("default", {
        roleName: defaultRole.name,
        policyName: "AliyunLogFullAccess",
        policyType: "System",
    });
    const defaultService = new alicloud.fc.Service("default", {
        name: `example-value-${_default.result}`,
        description: "example-value",
        role: defaultRole.arn,
        logConfig: {
            project: defaultProject.name,
            logstore: defaultStore.name,
            enableInstanceMetrics: true,
            enableRequestMetrics: true,
        },
    });
    const defaultBucket = new alicloud.oss.Bucket("default", {bucket: `terraform-example-${_default.result}`});
    // If you upload the function by OSS Bucket, you need to specify path can't upload by content.
    const defaultBucketObject = new alicloud.oss.BucketObject("default", {
        bucket: defaultBucket.id,
        key: "index.py",
        content: `import logging 
    def handler(event, context): 
    logger = logging.getLogger() 
    logger.info('hello world') 
    return 'hello world'`,
    });
    const defaultFunction = new alicloud.fc.Function("default", {
        service: defaultService.name,
        name: "terraform-example",
        description: "example",
        ossBucket: defaultBucket.id,
        ossKey: defaultBucketObject.key,
        memorySize: 512,
        runtime: "python2.7",
        handler: "hello.handler",
    });
    const defaultCustomDomain = new alicloud.fc.CustomDomain("default", {
        domainName: "terraform.functioncompute.com",
        protocol: "HTTP",
        routeConfigs: [{
            path: "/login/*",
            serviceName: defaultService.name,
            functionName: defaultFunction.name,
            qualifier: "?query",
            methods: [
                "GET",
                "POST",
            ],
        }],
        certConfig: {
            certName: "example",
            certificate: `-----BEGIN CERTIFICATE-----
    MIICWD****-----END CERTIFICATE-----`,
            privateKey: `-----BEGIN RSA PRIVATE KEY-----
    MIICX****n-----END RSA PRIVATE KEY-----`,
        },
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    default = random.index.Integer("default",
        max=99999,
        min=10000)
    default_project = alicloud.log.Project("default", name=f"example-value-{default['result']}")
    default_store = alicloud.log.Store("default",
        project=default_project.name,
        name="example-value")
    default_role = alicloud.ram.Role("default",
        name=f"fcservicerole-{default['result']}",
        document="""  {
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Effect": "Allow",
              "Principal": {
                "Service": [
                  "fc.aliyuncs.com"
                ]
              }
            }
          ],
          "Version": "1"
      }
    """,
        description="this is a example",
        force=True)
    default_role_policy_attachment = alicloud.ram.RolePolicyAttachment("default",
        role_name=default_role.name,
        policy_name="AliyunLogFullAccess",
        policy_type="System")
    default_service = alicloud.fc.Service("default",
        name=f"example-value-{default['result']}",
        description="example-value",
        role=default_role.arn,
        log_config={
            "project": default_project.name,
            "logstore": default_store.name,
            "enable_instance_metrics": True,
            "enable_request_metrics": True,
        })
    default_bucket = alicloud.oss.Bucket("default", bucket=f"terraform-example-{default['result']}")
    # If you upload the function by OSS Bucket, you need to specify path can't upload by content.
    default_bucket_object = alicloud.oss.BucketObject("default",
        bucket=default_bucket.id,
        key="index.py",
        content="""import logging 
    def handler(event, context): 
    logger = logging.getLogger() 
    logger.info('hello world') 
    return 'hello world'""")
    default_function = alicloud.fc.Function("default",
        service=default_service.name,
        name="terraform-example",
        description="example",
        oss_bucket=default_bucket.id,
        oss_key=default_bucket_object.key,
        memory_size=512,
        runtime="python2.7",
        handler="hello.handler")
    default_custom_domain = alicloud.fc.CustomDomain("default",
        domain_name="terraform.functioncompute.com",
        protocol="HTTP",
        route_configs=[{
            "path": "/login/*",
            "service_name": default_service.name,
            "function_name": default_function.name,
            "qualifier": "?query",
            "methods": [
                "GET",
                "POST",
            ],
        }],
        cert_config={
            "cert_name": "example",
            "certificate": """-----BEGIN CERTIFICATE-----
    MIICWD****-----END CERTIFICATE-----""",
            "private_key": """-----BEGIN RSA PRIVATE KEY-----
    MIICX****n-----END RSA PRIVATE KEY-----""",
        })
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/fc"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/oss"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
    			Max: 99999,
    			Min: 10000,
    		})
    		if err != nil {
    			return err
    		}
    		defaultProject, err := log.NewProject(ctx, "default", &log.ProjectArgs{
    			Name: pulumi.Sprintf("example-value-%v", _default.Result),
    		})
    		if err != nil {
    			return err
    		}
    		defaultStore, err := log.NewStore(ctx, "default", &log.StoreArgs{
    			Project: defaultProject.Name,
    			Name:    pulumi.String("example-value"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultRole, err := ram.NewRole(ctx, "default", &ram.RoleArgs{
    			Name: pulumi.Sprintf("fcservicerole-%v", _default.Result),
    			Document: pulumi.String(`  {
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Effect": "Allow",
              "Principal": {
                "Service": [
                  "fc.aliyuncs.com"
                ]
              }
            }
          ],
          "Version": "1"
      }
    `),
    			Description: pulumi.String("this is a example"),
    			Force:       pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ram.NewRolePolicyAttachment(ctx, "default", &ram.RolePolicyAttachmentArgs{
    			RoleName:   defaultRole.Name,
    			PolicyName: pulumi.String("AliyunLogFullAccess"),
    			PolicyType: pulumi.String("System"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultService, err := fc.NewService(ctx, "default", &fc.ServiceArgs{
    			Name:        pulumi.Sprintf("example-value-%v", _default.Result),
    			Description: pulumi.String("example-value"),
    			Role:        defaultRole.Arn,
    			LogConfig: &fc.ServiceLogConfigArgs{
    				Project:               defaultProject.Name,
    				Logstore:              defaultStore.Name,
    				EnableInstanceMetrics: pulumi.Bool(true),
    				EnableRequestMetrics:  pulumi.Bool(true),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		defaultBucket, err := oss.NewBucket(ctx, "default", &oss.BucketArgs{
    			Bucket: pulumi.Sprintf("terraform-example-%v", _default.Result),
    		})
    		if err != nil {
    			return err
    		}
    		// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
    		defaultBucketObject, err := oss.NewBucketObject(ctx, "default", &oss.BucketObjectArgs{
    			Bucket:  defaultBucket.ID(),
    			Key:     pulumi.String("index.py"),
    			Content: pulumi.String("import logging \ndef handler(event, context): \nlogger = logging.getLogger() \nlogger.info('hello world') \nreturn 'hello world'"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultFunction, err := fc.NewFunction(ctx, "default", &fc.FunctionArgs{
    			Service:     defaultService.Name,
    			Name:        pulumi.String("terraform-example"),
    			Description: pulumi.String("example"),
    			OssBucket:   defaultBucket.ID(),
    			OssKey:      defaultBucketObject.Key,
    			MemorySize:  pulumi.Int(512),
    			Runtime:     pulumi.String("python2.7"),
    			Handler:     pulumi.String("hello.handler"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = fc.NewCustomDomain(ctx, "default", &fc.CustomDomainArgs{
    			DomainName: pulumi.String("terraform.functioncompute.com"),
    			Protocol:   pulumi.String("HTTP"),
    			RouteConfigs: fc.CustomDomainRouteConfigArray{
    				&fc.CustomDomainRouteConfigArgs{
    					Path:         pulumi.String("/login/*"),
    					ServiceName:  defaultService.Name,
    					FunctionName: defaultFunction.Name,
    					Qualifier:    pulumi.String("?query"),
    					Methods: pulumi.StringArray{
    						pulumi.String("GET"),
    						pulumi.String("POST"),
    					},
    				},
    			},
    			CertConfig: &fc.CustomDomainCertConfigArgs{
    				CertName:    pulumi.String("example"),
    				Certificate: pulumi.String("-----BEGIN CERTIFICATE-----\nMIICWD****-----END CERTIFICATE-----"),
    				PrivateKey:  pulumi.String("-----BEGIN RSA PRIVATE KEY-----\nMIICX****n-----END RSA PRIVATE KEY-----"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = new Random.Index.Integer("default", new()
        {
            Max = 99999,
            Min = 10000,
        });
    
        var defaultProject = new AliCloud.Log.Project("default", new()
        {
            Name = $"example-value-{@default.Result}",
        });
    
        var defaultStore = new AliCloud.Log.Store("default", new()
        {
            Project = defaultProject.Name,
            Name = "example-value",
        });
    
        var defaultRole = new AliCloud.Ram.Role("default", new()
        {
            Name = $"fcservicerole-{@default.Result}",
            Document = @"  {
          ""Statement"": [
            {
              ""Action"": ""sts:AssumeRole"",
              ""Effect"": ""Allow"",
              ""Principal"": {
                ""Service"": [
                  ""fc.aliyuncs.com""
                ]
              }
            }
          ],
          ""Version"": ""1""
      }
    ",
            Description = "this is a example",
            Force = true,
        });
    
        var defaultRolePolicyAttachment = new AliCloud.Ram.RolePolicyAttachment("default", new()
        {
            RoleName = defaultRole.Name,
            PolicyName = "AliyunLogFullAccess",
            PolicyType = "System",
        });
    
        var defaultService = new AliCloud.FC.Service("default", new()
        {
            Name = $"example-value-{@default.Result}",
            Description = "example-value",
            Role = defaultRole.Arn,
            LogConfig = new AliCloud.FC.Inputs.ServiceLogConfigArgs
            {
                Project = defaultProject.Name,
                Logstore = defaultStore.Name,
                EnableInstanceMetrics = true,
                EnableRequestMetrics = true,
            },
        });
    
        var defaultBucket = new AliCloud.Oss.Bucket("default", new()
        {
            BucketName = $"terraform-example-{@default.Result}",
        });
    
        // If you upload the function by OSS Bucket, you need to specify path can't upload by content.
        var defaultBucketObject = new AliCloud.Oss.BucketObject("default", new()
        {
            Bucket = defaultBucket.Id,
            Key = "index.py",
            Content = @"import logging 
    def handler(event, context): 
    logger = logging.getLogger() 
    logger.info('hello world') 
    return 'hello world'",
        });
    
        var defaultFunction = new AliCloud.FC.Function("default", new()
        {
            Service = defaultService.Name,
            Name = "terraform-example",
            Description = "example",
            OssBucket = defaultBucket.Id,
            OssKey = defaultBucketObject.Key,
            MemorySize = 512,
            Runtime = "python2.7",
            Handler = "hello.handler",
        });
    
        var defaultCustomDomain = new AliCloud.FC.CustomDomain("default", new()
        {
            DomainName = "terraform.functioncompute.com",
            Protocol = "HTTP",
            RouteConfigs = new[]
            {
                new AliCloud.FC.Inputs.CustomDomainRouteConfigArgs
                {
                    Path = "/login/*",
                    ServiceName = defaultService.Name,
                    FunctionName = defaultFunction.Name,
                    Qualifier = "?query",
                    Methods = new[]
                    {
                        "GET",
                        "POST",
                    },
                },
            },
            CertConfig = new AliCloud.FC.Inputs.CustomDomainCertConfigArgs
            {
                CertName = "example",
                Certificate = @"-----BEGIN CERTIFICATE-----
    MIICWD****-----END CERTIFICATE-----",
                PrivateKey = @"-----BEGIN RSA PRIVATE KEY-----
    MIICX****n-----END RSA PRIVATE KEY-----",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.random.integer;
    import com.pulumi.random.IntegerArgs;
    import com.pulumi.alicloud.log.Project;
    import com.pulumi.alicloud.log.ProjectArgs;
    import com.pulumi.alicloud.log.Store;
    import com.pulumi.alicloud.log.StoreArgs;
    import com.pulumi.alicloud.ram.Role;
    import com.pulumi.alicloud.ram.RoleArgs;
    import com.pulumi.alicloud.ram.RolePolicyAttachment;
    import com.pulumi.alicloud.ram.RolePolicyAttachmentArgs;
    import com.pulumi.alicloud.fc.Service;
    import com.pulumi.alicloud.fc.ServiceArgs;
    import com.pulumi.alicloud.fc.inputs.ServiceLogConfigArgs;
    import com.pulumi.alicloud.oss.Bucket;
    import com.pulumi.alicloud.oss.BucketArgs;
    import com.pulumi.alicloud.oss.BucketObject;
    import com.pulumi.alicloud.oss.BucketObjectArgs;
    import com.pulumi.alicloud.fc.Function;
    import com.pulumi.alicloud.fc.FunctionArgs;
    import com.pulumi.alicloud.fc.CustomDomain;
    import com.pulumi.alicloud.fc.CustomDomainArgs;
    import com.pulumi.alicloud.fc.inputs.CustomDomainRouteConfigArgs;
    import com.pulumi.alicloud.fc.inputs.CustomDomainCertConfigArgs;
    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 default_ = new Integer("default", IntegerArgs.builder()
                .max(99999)
                .min(10000)
                .build());
    
            var defaultProject = new Project("defaultProject", ProjectArgs.builder()
                .name(String.format("example-value-%s", default_.result()))
                .build());
    
            var defaultStore = new Store("defaultStore", StoreArgs.builder()
                .project(defaultProject.name())
                .name("example-value")
                .build());
    
            var defaultRole = new Role("defaultRole", RoleArgs.builder()
                .name(String.format("fcservicerole-%s", default_.result()))
                .document("""
      {
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Effect": "Allow",
              "Principal": {
                "Service": [
                  "fc.aliyuncs.com"
                ]
              }
            }
          ],
          "Version": "1"
      }
                """)
                .description("this is a example")
                .force(true)
                .build());
    
            var defaultRolePolicyAttachment = new RolePolicyAttachment("defaultRolePolicyAttachment", RolePolicyAttachmentArgs.builder()
                .roleName(defaultRole.name())
                .policyName("AliyunLogFullAccess")
                .policyType("System")
                .build());
    
            var defaultService = new Service("defaultService", ServiceArgs.builder()
                .name(String.format("example-value-%s", default_.result()))
                .description("example-value")
                .role(defaultRole.arn())
                .logConfig(ServiceLogConfigArgs.builder()
                    .project(defaultProject.name())
                    .logstore(defaultStore.name())
                    .enableInstanceMetrics(true)
                    .enableRequestMetrics(true)
                    .build())
                .build());
    
            var defaultBucket = new Bucket("defaultBucket", BucketArgs.builder()
                .bucket(String.format("terraform-example-%s", default_.result()))
                .build());
    
            // If you upload the function by OSS Bucket, you need to specify path can't upload by content.
            var defaultBucketObject = new BucketObject("defaultBucketObject", BucketObjectArgs.builder()
                .bucket(defaultBucket.id())
                .key("index.py")
                .content("""
    import logging 
    def handler(event, context): 
    logger = logging.getLogger() 
    logger.info('hello world') 
    return 'hello world'            """)
                .build());
    
            var defaultFunction = new Function("defaultFunction", FunctionArgs.builder()
                .service(defaultService.name())
                .name("terraform-example")
                .description("example")
                .ossBucket(defaultBucket.id())
                .ossKey(defaultBucketObject.key())
                .memorySize("512")
                .runtime("python2.7")
                .handler("hello.handler")
                .build());
    
            var defaultCustomDomain = new CustomDomain("defaultCustomDomain", CustomDomainArgs.builder()
                .domainName("terraform.functioncompute.com")
                .protocol("HTTP")
                .routeConfigs(CustomDomainRouteConfigArgs.builder()
                    .path("/login/*")
                    .serviceName(defaultService.name())
                    .functionName(defaultFunction.name())
                    .qualifier("?query")
                    .methods(                
                        "GET",
                        "POST")
                    .build())
                .certConfig(CustomDomainCertConfigArgs.builder()
                    .certName("example")
                    .certificate("""
    -----BEGIN CERTIFICATE-----
    MIICWD****-----END CERTIFICATE-----                """)
                    .privateKey("""
    -----BEGIN RSA PRIVATE KEY-----
    MIICX****n-----END RSA PRIVATE KEY-----                """)
                    .build())
                .build());
    
        }
    }
    
    resources:
      default:
        type: random:integer
        properties:
          max: 99999
          min: 10000
      defaultProject:
        type: alicloud:log:Project
        name: default
        properties:
          name: example-value-${default.result}
      defaultStore:
        type: alicloud:log:Store
        name: default
        properties:
          project: ${defaultProject.name}
          name: example-value
      defaultRole:
        type: alicloud:ram:Role
        name: default
        properties:
          name: fcservicerole-${default.result}
          document: |2
              {
                  "Statement": [
                    {
                      "Action": "sts:AssumeRole",
                      "Effect": "Allow",
                      "Principal": {
                        "Service": [
                          "fc.aliyuncs.com"
                        ]
                      }
                    }
                  ],
                  "Version": "1"
              }
          description: this is a example
          force: true
      defaultRolePolicyAttachment:
        type: alicloud:ram:RolePolicyAttachment
        name: default
        properties:
          roleName: ${defaultRole.name}
          policyName: AliyunLogFullAccess
          policyType: System
      defaultService:
        type: alicloud:fc:Service
        name: default
        properties:
          name: example-value-${default.result}
          description: example-value
          role: ${defaultRole.arn}
          logConfig:
            project: ${defaultProject.name}
            logstore: ${defaultStore.name}
            enableInstanceMetrics: true
            enableRequestMetrics: true
      defaultBucket:
        type: alicloud:oss:Bucket
        name: default
        properties:
          bucket: terraform-example-${default.result}
      # If you upload the function by OSS Bucket, you need to specify path can't upload by content.
      defaultBucketObject:
        type: alicloud:oss:BucketObject
        name: default
        properties:
          bucket: ${defaultBucket.id}
          key: index.py
          content: "import logging \ndef handler(event, context): \nlogger = logging.getLogger() \nlogger.info('hello world') \nreturn 'hello world'"
      defaultFunction:
        type: alicloud:fc:Function
        name: default
        properties:
          service: ${defaultService.name}
          name: terraform-example
          description: example
          ossBucket: ${defaultBucket.id}
          ossKey: ${defaultBucketObject.key}
          memorySize: '512'
          runtime: python2.7
          handler: hello.handler
      defaultCustomDomain:
        type: alicloud:fc:CustomDomain
        name: default
        properties:
          domainName: terraform.functioncompute.com
          protocol: HTTP
          routeConfigs:
            - path: /login/*
              serviceName: ${defaultService.name}
              functionName: ${defaultFunction.name}
              qualifier: ?query
              methods:
                - GET
                - POST
          certConfig:
            certName: example
            certificate: |-
              -----BEGIN CERTIFICATE-----
              MIICWD****-----END CERTIFICATE-----          
            privateKey: |-
              -----BEGIN RSA PRIVATE KEY-----
              MIICX****n-----END RSA PRIVATE KEY-----          
    

    Create CustomDomain Resource

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

    Constructor syntax

    new CustomDomain(name: string, args: CustomDomainArgs, opts?: CustomResourceOptions);
    @overload
    def CustomDomain(resource_name: str,
                     args: CustomDomainArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def CustomDomain(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     domain_name: Optional[str] = None,
                     protocol: Optional[str] = None,
                     cert_config: Optional[CustomDomainCertConfigArgs] = None,
                     route_configs: Optional[Sequence[CustomDomainRouteConfigArgs]] = None)
    func NewCustomDomain(ctx *Context, name string, args CustomDomainArgs, opts ...ResourceOption) (*CustomDomain, error)
    public CustomDomain(string name, CustomDomainArgs args, CustomResourceOptions? opts = null)
    public CustomDomain(String name, CustomDomainArgs args)
    public CustomDomain(String name, CustomDomainArgs args, CustomResourceOptions options)
    
    type: alicloud:fc:CustomDomain
    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 CustomDomainArgs
    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 CustomDomainArgs
    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 CustomDomainArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CustomDomainArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CustomDomainArgs
    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 customDomainResource = new AliCloud.FC.CustomDomain("customDomainResource", new()
    {
        DomainName = "string",
        Protocol = "string",
        CertConfig = new AliCloud.FC.Inputs.CustomDomainCertConfigArgs
        {
            CertName = "string",
            Certificate = "string",
            PrivateKey = "string",
        },
        RouteConfigs = new[]
        {
            new AliCloud.FC.Inputs.CustomDomainRouteConfigArgs
            {
                FunctionName = "string",
                Path = "string",
                ServiceName = "string",
                Methods = new[]
                {
                    "string",
                },
                Qualifier = "string",
            },
        },
    });
    
    example, err := fc.NewCustomDomain(ctx, "customDomainResource", &fc.CustomDomainArgs{
    	DomainName: pulumi.String("string"),
    	Protocol:   pulumi.String("string"),
    	CertConfig: &fc.CustomDomainCertConfigArgs{
    		CertName:    pulumi.String("string"),
    		Certificate: pulumi.String("string"),
    		PrivateKey:  pulumi.String("string"),
    	},
    	RouteConfigs: fc.CustomDomainRouteConfigArray{
    		&fc.CustomDomainRouteConfigArgs{
    			FunctionName: pulumi.String("string"),
    			Path:         pulumi.String("string"),
    			ServiceName:  pulumi.String("string"),
    			Methods: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			Qualifier: pulumi.String("string"),
    		},
    	},
    })
    
    var customDomainResource = new CustomDomain("customDomainResource", CustomDomainArgs.builder()
        .domainName("string")
        .protocol("string")
        .certConfig(CustomDomainCertConfigArgs.builder()
            .certName("string")
            .certificate("string")
            .privateKey("string")
            .build())
        .routeConfigs(CustomDomainRouteConfigArgs.builder()
            .functionName("string")
            .path("string")
            .serviceName("string")
            .methods("string")
            .qualifier("string")
            .build())
        .build());
    
    custom_domain_resource = alicloud.fc.CustomDomain("customDomainResource",
        domain_name="string",
        protocol="string",
        cert_config={
            "cert_name": "string",
            "certificate": "string",
            "private_key": "string",
        },
        route_configs=[{
            "function_name": "string",
            "path": "string",
            "service_name": "string",
            "methods": ["string"],
            "qualifier": "string",
        }])
    
    const customDomainResource = new alicloud.fc.CustomDomain("customDomainResource", {
        domainName: "string",
        protocol: "string",
        certConfig: {
            certName: "string",
            certificate: "string",
            privateKey: "string",
        },
        routeConfigs: [{
            functionName: "string",
            path: "string",
            serviceName: "string",
            methods: ["string"],
            qualifier: "string",
        }],
    });
    
    type: alicloud:fc:CustomDomain
    properties:
        certConfig:
            certName: string
            certificate: string
            privateKey: string
        domainName: string
        protocol: string
        routeConfigs:
            - functionName: string
              methods:
                - string
              path: string
              qualifier: string
              serviceName: string
    

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

    DomainName string
    The custom domain name. For example, "example.com".
    Protocol string
    The protocol, HTTP or HTTP,HTTPS.
    CertConfig Pulumi.AliCloud.FC.Inputs.CustomDomainCertConfig
    The configuration of HTTPS certificate.See cert_config below.
    RouteConfigs List<Pulumi.AliCloud.FC.Inputs.CustomDomainRouteConfig>
    The configuration of domain route, mapping the path and Function Compute function.See route_config below.
    DomainName string
    The custom domain name. For example, "example.com".
    Protocol string
    The protocol, HTTP or HTTP,HTTPS.
    CertConfig CustomDomainCertConfigArgs
    The configuration of HTTPS certificate.See cert_config below.
    RouteConfigs []CustomDomainRouteConfigArgs
    The configuration of domain route, mapping the path and Function Compute function.See route_config below.
    domainName String
    The custom domain name. For example, "example.com".
    protocol String
    The protocol, HTTP or HTTP,HTTPS.
    certConfig CustomDomainCertConfig
    The configuration of HTTPS certificate.See cert_config below.
    routeConfigs List<CustomDomainRouteConfig>
    The configuration of domain route, mapping the path and Function Compute function.See route_config below.
    domainName string
    The custom domain name. For example, "example.com".
    protocol string
    The protocol, HTTP or HTTP,HTTPS.
    certConfig CustomDomainCertConfig
    The configuration of HTTPS certificate.See cert_config below.
    routeConfigs CustomDomainRouteConfig[]
    The configuration of domain route, mapping the path and Function Compute function.See route_config below.
    domain_name str
    The custom domain name. For example, "example.com".
    protocol str
    The protocol, HTTP or HTTP,HTTPS.
    cert_config CustomDomainCertConfigArgs
    The configuration of HTTPS certificate.See cert_config below.
    route_configs Sequence[CustomDomainRouteConfigArgs]
    The configuration of domain route, mapping the path and Function Compute function.See route_config below.
    domainName String
    The custom domain name. For example, "example.com".
    protocol String
    The protocol, HTTP or HTTP,HTTPS.
    certConfig Property Map
    The configuration of HTTPS certificate.See cert_config below.
    routeConfigs List<Property Map>
    The configuration of domain route, mapping the path and Function Compute function.See route_config below.

    Outputs

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

    AccountId string
    The account id.
    ApiVersion string
    The api version of Function Compute.
    CreatedTime string
    The date this resource was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    LastModifiedTime string
    The date this resource was last modified.
    AccountId string
    The account id.
    ApiVersion string
    The api version of Function Compute.
    CreatedTime string
    The date this resource was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    LastModifiedTime string
    The date this resource was last modified.
    accountId String
    The account id.
    apiVersion String
    The api version of Function Compute.
    createdTime String
    The date this resource was created.
    id String
    The provider-assigned unique ID for this managed resource.
    lastModifiedTime String
    The date this resource was last modified.
    accountId string
    The account id.
    apiVersion string
    The api version of Function Compute.
    createdTime string
    The date this resource was created.
    id string
    The provider-assigned unique ID for this managed resource.
    lastModifiedTime string
    The date this resource was last modified.
    account_id str
    The account id.
    api_version str
    The api version of Function Compute.
    created_time str
    The date this resource was created.
    id str
    The provider-assigned unique ID for this managed resource.
    last_modified_time str
    The date this resource was last modified.
    accountId String
    The account id.
    apiVersion String
    The api version of Function Compute.
    createdTime String
    The date this resource was created.
    id String
    The provider-assigned unique ID for this managed resource.
    lastModifiedTime String
    The date this resource was last modified.

    Look up Existing CustomDomain Resource

    Get an existing CustomDomain 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?: CustomDomainState, opts?: CustomResourceOptions): CustomDomain
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            api_version: Optional[str] = None,
            cert_config: Optional[CustomDomainCertConfigArgs] = None,
            created_time: Optional[str] = None,
            domain_name: Optional[str] = None,
            last_modified_time: Optional[str] = None,
            protocol: Optional[str] = None,
            route_configs: Optional[Sequence[CustomDomainRouteConfigArgs]] = None) -> CustomDomain
    func GetCustomDomain(ctx *Context, name string, id IDInput, state *CustomDomainState, opts ...ResourceOption) (*CustomDomain, error)
    public static CustomDomain Get(string name, Input<string> id, CustomDomainState? state, CustomResourceOptions? opts = null)
    public static CustomDomain get(String name, Output<String> id, CustomDomainState 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:
    AccountId string
    The account id.
    ApiVersion string
    The api version of Function Compute.
    CertConfig Pulumi.AliCloud.FC.Inputs.CustomDomainCertConfig
    The configuration of HTTPS certificate.See cert_config below.
    CreatedTime string
    The date this resource was created.
    DomainName string
    The custom domain name. For example, "example.com".
    LastModifiedTime string
    The date this resource was last modified.
    Protocol string
    The protocol, HTTP or HTTP,HTTPS.
    RouteConfigs List<Pulumi.AliCloud.FC.Inputs.CustomDomainRouteConfig>
    The configuration of domain route, mapping the path and Function Compute function.See route_config below.
    AccountId string
    The account id.
    ApiVersion string
    The api version of Function Compute.
    CertConfig CustomDomainCertConfigArgs
    The configuration of HTTPS certificate.See cert_config below.
    CreatedTime string
    The date this resource was created.
    DomainName string
    The custom domain name. For example, "example.com".
    LastModifiedTime string
    The date this resource was last modified.
    Protocol string
    The protocol, HTTP or HTTP,HTTPS.
    RouteConfigs []CustomDomainRouteConfigArgs
    The configuration of domain route, mapping the path and Function Compute function.See route_config below.
    accountId String
    The account id.
    apiVersion String
    The api version of Function Compute.
    certConfig CustomDomainCertConfig
    The configuration of HTTPS certificate.See cert_config below.
    createdTime String
    The date this resource was created.
    domainName String
    The custom domain name. For example, "example.com".
    lastModifiedTime String
    The date this resource was last modified.
    protocol String
    The protocol, HTTP or HTTP,HTTPS.
    routeConfigs List<CustomDomainRouteConfig>
    The configuration of domain route, mapping the path and Function Compute function.See route_config below.
    accountId string
    The account id.
    apiVersion string
    The api version of Function Compute.
    certConfig CustomDomainCertConfig
    The configuration of HTTPS certificate.See cert_config below.
    createdTime string
    The date this resource was created.
    domainName string
    The custom domain name. For example, "example.com".
    lastModifiedTime string
    The date this resource was last modified.
    protocol string
    The protocol, HTTP or HTTP,HTTPS.
    routeConfigs CustomDomainRouteConfig[]
    The configuration of domain route, mapping the path and Function Compute function.See route_config below.
    account_id str
    The account id.
    api_version str
    The api version of Function Compute.
    cert_config CustomDomainCertConfigArgs
    The configuration of HTTPS certificate.See cert_config below.
    created_time str
    The date this resource was created.
    domain_name str
    The custom domain name. For example, "example.com".
    last_modified_time str
    The date this resource was last modified.
    protocol str
    The protocol, HTTP or HTTP,HTTPS.
    route_configs Sequence[CustomDomainRouteConfigArgs]
    The configuration of domain route, mapping the path and Function Compute function.See route_config below.
    accountId String
    The account id.
    apiVersion String
    The api version of Function Compute.
    certConfig Property Map
    The configuration of HTTPS certificate.See cert_config below.
    createdTime String
    The date this resource was created.
    domainName String
    The custom domain name. For example, "example.com".
    lastModifiedTime String
    The date this resource was last modified.
    protocol String
    The protocol, HTTP or HTTP,HTTPS.
    routeConfigs List<Property Map>
    The configuration of domain route, mapping the path and Function Compute function.See route_config below.

    Supporting Types

    CustomDomainCertConfig, CustomDomainCertConfigArgs

    CertName string
    The name of the certificate, used to distinguish different certificates.
    Certificate string
    Certificate data of the HTTPS certificates, follow the 'pem' format.
    PrivateKey string
    Private key of the HTTPS certificates, follow the 'pem' format.
    CertName string
    The name of the certificate, used to distinguish different certificates.
    Certificate string
    Certificate data of the HTTPS certificates, follow the 'pem' format.
    PrivateKey string
    Private key of the HTTPS certificates, follow the 'pem' format.
    certName String
    The name of the certificate, used to distinguish different certificates.
    certificate String
    Certificate data of the HTTPS certificates, follow the 'pem' format.
    privateKey String
    Private key of the HTTPS certificates, follow the 'pem' format.
    certName string
    The name of the certificate, used to distinguish different certificates.
    certificate string
    Certificate data of the HTTPS certificates, follow the 'pem' format.
    privateKey string
    Private key of the HTTPS certificates, follow the 'pem' format.
    cert_name str
    The name of the certificate, used to distinguish different certificates.
    certificate str
    Certificate data of the HTTPS certificates, follow the 'pem' format.
    private_key str
    Private key of the HTTPS certificates, follow the 'pem' format.
    certName String
    The name of the certificate, used to distinguish different certificates.
    certificate String
    Certificate data of the HTTPS certificates, follow the 'pem' format.
    privateKey String
    Private key of the HTTPS certificates, follow the 'pem' format.

    CustomDomainRouteConfig, CustomDomainRouteConfigArgs

    FunctionName string
    The name of the Function Compute function that requests are routed to.
    Path string
    The path that requests are routed from.
    ServiceName string
    The name of the Function Compute service that requests are routed to.
    Methods List<string>
    The requests of the specified HTTP methos are routed from. Valid method: GET, POST, DELETE, HEAD, PUT and PATCH. For example, "GET, HEAD" methods indicate that only requests from GET and HEAD methods are routed.
    Qualifier string
    The version or alias of the Function Compute service that requests are routed to. For example, qualifier v1 indicates that the requests are routed to the version 1 Function Compute service. For detail information about version and alias, please refer to the developer guide.
    FunctionName string
    The name of the Function Compute function that requests are routed to.
    Path string
    The path that requests are routed from.
    ServiceName string
    The name of the Function Compute service that requests are routed to.
    Methods []string
    The requests of the specified HTTP methos are routed from. Valid method: GET, POST, DELETE, HEAD, PUT and PATCH. For example, "GET, HEAD" methods indicate that only requests from GET and HEAD methods are routed.
    Qualifier string
    The version or alias of the Function Compute service that requests are routed to. For example, qualifier v1 indicates that the requests are routed to the version 1 Function Compute service. For detail information about version and alias, please refer to the developer guide.
    functionName String
    The name of the Function Compute function that requests are routed to.
    path String
    The path that requests are routed from.
    serviceName String
    The name of the Function Compute service that requests are routed to.
    methods List<String>
    The requests of the specified HTTP methos are routed from. Valid method: GET, POST, DELETE, HEAD, PUT and PATCH. For example, "GET, HEAD" methods indicate that only requests from GET and HEAD methods are routed.
    qualifier String
    The version or alias of the Function Compute service that requests are routed to. For example, qualifier v1 indicates that the requests are routed to the version 1 Function Compute service. For detail information about version and alias, please refer to the developer guide.
    functionName string
    The name of the Function Compute function that requests are routed to.
    path string
    The path that requests are routed from.
    serviceName string
    The name of the Function Compute service that requests are routed to.
    methods string[]
    The requests of the specified HTTP methos are routed from. Valid method: GET, POST, DELETE, HEAD, PUT and PATCH. For example, "GET, HEAD" methods indicate that only requests from GET and HEAD methods are routed.
    qualifier string
    The version or alias of the Function Compute service that requests are routed to. For example, qualifier v1 indicates that the requests are routed to the version 1 Function Compute service. For detail information about version and alias, please refer to the developer guide.
    function_name str
    The name of the Function Compute function that requests are routed to.
    path str
    The path that requests are routed from.
    service_name str
    The name of the Function Compute service that requests are routed to.
    methods Sequence[str]
    The requests of the specified HTTP methos are routed from. Valid method: GET, POST, DELETE, HEAD, PUT and PATCH. For example, "GET, HEAD" methods indicate that only requests from GET and HEAD methods are routed.
    qualifier str
    The version or alias of the Function Compute service that requests are routed to. For example, qualifier v1 indicates that the requests are routed to the version 1 Function Compute service. For detail information about version and alias, please refer to the developer guide.
    functionName String
    The name of the Function Compute function that requests are routed to.
    path String
    The path that requests are routed from.
    serviceName String
    The name of the Function Compute service that requests are routed to.
    methods List<String>
    The requests of the specified HTTP methos are routed from. Valid method: GET, POST, DELETE, HEAD, PUT and PATCH. For example, "GET, HEAD" methods indicate that only requests from GET and HEAD methods are routed.
    qualifier String
    The version or alias of the Function Compute service that requests are routed to. For example, qualifier v1 indicates that the requests are routed to the version 1 Function Compute service. For detail information about version and alias, please refer to the developer guide.

    Import

    Function Compute custom domain can be imported using the id or the domain name, e.g.

    $ pulumi import alicloud:fc/customDomain:CustomDomain foo my-fc-custom-domain
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi