1. Packages
  2. Scaleway
  3. API Docs
  4. FunctionDomain
Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse

scaleway.FunctionDomain

Explore with Pulumi AI

scaleway logo
Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse

    Creates and manages Scaleway Function Domain bindings. For more information see the documentation.

    Example Usage

    Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const mainFunctionNamespace = new scaleway.FunctionNamespace("mainFunctionNamespace", {});
    const mainFunction = new scaleway.Function("mainFunction", {
        namespaceId: mainFunctionNamespace.id,
        runtime: "go118",
        privacy: "private",
        handler: "Handle",
        zipFile: "testfixture/gofunction.zip",
        deploy: true,
    });
    const mainFunctionDomain = new scaleway.FunctionDomain("mainFunctionDomain", {
        functionId: mainFunction.id,
        hostname: "example.com",
    }, {
        dependsOn: [mainFunction],
    });
    
    import pulumi
    import pulumiverse_scaleway as scaleway
    
    main_function_namespace = scaleway.FunctionNamespace("mainFunctionNamespace")
    main_function = scaleway.Function("mainFunction",
        namespace_id=main_function_namespace.id,
        runtime="go118",
        privacy="private",
        handler="Handle",
        zip_file="testfixture/gofunction.zip",
        deploy=True)
    main_function_domain = scaleway.FunctionDomain("mainFunctionDomain",
        function_id=main_function.id,
        hostname="example.com",
        opts=pulumi.ResourceOptions(depends_on=[main_function]))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		mainFunctionNamespace, err := scaleway.NewFunctionNamespace(ctx, "mainFunctionNamespace", nil)
    		if err != nil {
    			return err
    		}
    		mainFunction, err := scaleway.NewFunction(ctx, "mainFunction", &scaleway.FunctionArgs{
    			NamespaceId: mainFunctionNamespace.ID(),
    			Runtime:     pulumi.String("go118"),
    			Privacy:     pulumi.String("private"),
    			Handler:     pulumi.String("Handle"),
    			ZipFile:     pulumi.String("testfixture/gofunction.zip"),
    			Deploy:      pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = scaleway.NewFunctionDomain(ctx, "mainFunctionDomain", &scaleway.FunctionDomainArgs{
    			FunctionId: mainFunction.ID(),
    			Hostname:   pulumi.String("example.com"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			mainFunction,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumiverse.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        var mainFunctionNamespace = new Scaleway.FunctionNamespace("mainFunctionNamespace");
    
        var mainFunction = new Scaleway.Function("mainFunction", new()
        {
            NamespaceId = mainFunctionNamespace.Id,
            Runtime = "go118",
            Privacy = "private",
            Handler = "Handle",
            ZipFile = "testfixture/gofunction.zip",
            Deploy = true,
        });
    
        var mainFunctionDomain = new Scaleway.FunctionDomain("mainFunctionDomain", new()
        {
            FunctionId = mainFunction.Id,
            Hostname = "example.com",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                mainFunction, 
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.FunctionNamespace;
    import com.pulumi.scaleway.Function;
    import com.pulumi.scaleway.FunctionArgs;
    import com.pulumi.scaleway.FunctionDomain;
    import com.pulumi.scaleway.FunctionDomainArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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 mainFunctionNamespace = new FunctionNamespace("mainFunctionNamespace");
    
            var mainFunction = new Function("mainFunction", FunctionArgs.builder()        
                .namespaceId(mainFunctionNamespace.id())
                .runtime("go118")
                .privacy("private")
                .handler("Handle")
                .zipFile("testfixture/gofunction.zip")
                .deploy(true)
                .build());
    
            var mainFunctionDomain = new FunctionDomain("mainFunctionDomain", FunctionDomainArgs.builder()        
                .functionId(mainFunction.id())
                .hostname("example.com")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(mainFunction)
                    .build());
    
        }
    }
    
    resources:
      mainFunctionDomain:
        type: scaleway:FunctionDomain
        properties:
          functionId: ${mainFunction.id}
          hostname: example.com
        options:
          dependson:
            - ${mainFunction}
      mainFunctionNamespace:
        type: scaleway:FunctionNamespace
      mainFunction:
        type: scaleway:Function
        properties:
          namespaceId: ${mainFunctionNamespace.id}
          runtime: go118
          privacy: private
          handler: Handle
          zipFile: testfixture/gofunction.zip
          deploy: true
    

    Create FunctionDomain Resource

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

    Constructor syntax

    new FunctionDomain(name: string, args: FunctionDomainArgs, opts?: CustomResourceOptions);
    @overload
    def FunctionDomain(resource_name: str,
                       args: FunctionDomainArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def FunctionDomain(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       function_id: Optional[str] = None,
                       hostname: Optional[str] = None,
                       region: Optional[str] = None)
    func NewFunctionDomain(ctx *Context, name string, args FunctionDomainArgs, opts ...ResourceOption) (*FunctionDomain, error)
    public FunctionDomain(string name, FunctionDomainArgs args, CustomResourceOptions? opts = null)
    public FunctionDomain(String name, FunctionDomainArgs args)
    public FunctionDomain(String name, FunctionDomainArgs args, CustomResourceOptions options)
    
    type: scaleway:FunctionDomain
    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 FunctionDomainArgs
    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 FunctionDomainArgs
    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 FunctionDomainArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FunctionDomainArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FunctionDomainArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var functionDomainResource = new Scaleway.FunctionDomain("functionDomainResource", new()
    {
        FunctionId = "string",
        Hostname = "string",
        Region = "string",
    });
    
    example, err := scaleway.NewFunctionDomain(ctx, "functionDomainResource", &scaleway.FunctionDomainArgs{
    	FunctionId: pulumi.String("string"),
    	Hostname:   pulumi.String("string"),
    	Region:     pulumi.String("string"),
    })
    
    var functionDomainResource = new FunctionDomain("functionDomainResource", FunctionDomainArgs.builder()        
        .functionId("string")
        .hostname("string")
        .region("string")
        .build());
    
    function_domain_resource = scaleway.FunctionDomain("functionDomainResource",
        function_id="string",
        hostname="string",
        region="string")
    
    const functionDomainResource = new scaleway.FunctionDomain("functionDomainResource", {
        functionId: "string",
        hostname: "string",
        region: "string",
    });
    
    type: scaleway:FunctionDomain
    properties:
        functionId: string
        hostname: string
        region: string
    

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

    FunctionId string
    The ID of the function you want to create a domain with.
    Hostname string

    The hostname that should resolve to your function id native domain. You should use a CNAME domain record that point to your native function domain_name for it.

    Important Updates to function_id or hostname will recreate the domain.

    Region string
    (Defaults to provider region) The region in where the domain was created.
    FunctionId string
    The ID of the function you want to create a domain with.
    Hostname string

    The hostname that should resolve to your function id native domain. You should use a CNAME domain record that point to your native function domain_name for it.

    Important Updates to function_id or hostname will recreate the domain.

    Region string
    (Defaults to provider region) The region in where the domain was created.
    functionId String
    The ID of the function you want to create a domain with.
    hostname String

    The hostname that should resolve to your function id native domain. You should use a CNAME domain record that point to your native function domain_name for it.

    Important Updates to function_id or hostname will recreate the domain.

    region String
    (Defaults to provider region) The region in where the domain was created.
    functionId string
    The ID of the function you want to create a domain with.
    hostname string

    The hostname that should resolve to your function id native domain. You should use a CNAME domain record that point to your native function domain_name for it.

    Important Updates to function_id or hostname will recreate the domain.

    region string
    (Defaults to provider region) The region in where the domain was created.
    function_id str
    The ID of the function you want to create a domain with.
    hostname str

    The hostname that should resolve to your function id native domain. You should use a CNAME domain record that point to your native function domain_name for it.

    Important Updates to function_id or hostname will recreate the domain.

    region str
    (Defaults to provider region) The region in where the domain was created.
    functionId String
    The ID of the function you want to create a domain with.
    hostname String

    The hostname that should resolve to your function id native domain. You should use a CNAME domain record that point to your native function domain_name for it.

    Important Updates to function_id or hostname will recreate the domain.

    region String
    (Defaults to provider region) The region in where the domain was created.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Url string
    The URL that triggers the function
    Id string
    The provider-assigned unique ID for this managed resource.
    Url string
    The URL that triggers the function
    id String
    The provider-assigned unique ID for this managed resource.
    url String
    The URL that triggers the function
    id string
    The provider-assigned unique ID for this managed resource.
    url string
    The URL that triggers the function
    id str
    The provider-assigned unique ID for this managed resource.
    url str
    The URL that triggers the function
    id String
    The provider-assigned unique ID for this managed resource.
    url String
    The URL that triggers the function

    Look up Existing FunctionDomain Resource

    Get an existing FunctionDomain 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?: FunctionDomainState, opts?: CustomResourceOptions): FunctionDomain
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            function_id: Optional[str] = None,
            hostname: Optional[str] = None,
            region: Optional[str] = None,
            url: Optional[str] = None) -> FunctionDomain
    func GetFunctionDomain(ctx *Context, name string, id IDInput, state *FunctionDomainState, opts ...ResourceOption) (*FunctionDomain, error)
    public static FunctionDomain Get(string name, Input<string> id, FunctionDomainState? state, CustomResourceOptions? opts = null)
    public static FunctionDomain get(String name, Output<String> id, FunctionDomainState 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:
    FunctionId string
    The ID of the function you want to create a domain with.
    Hostname string

    The hostname that should resolve to your function id native domain. You should use a CNAME domain record that point to your native function domain_name for it.

    Important Updates to function_id or hostname will recreate the domain.

    Region string
    (Defaults to provider region) The region in where the domain was created.
    Url string
    The URL that triggers the function
    FunctionId string
    The ID of the function you want to create a domain with.
    Hostname string

    The hostname that should resolve to your function id native domain. You should use a CNAME domain record that point to your native function domain_name for it.

    Important Updates to function_id or hostname will recreate the domain.

    Region string
    (Defaults to provider region) The region in where the domain was created.
    Url string
    The URL that triggers the function
    functionId String
    The ID of the function you want to create a domain with.
    hostname String

    The hostname that should resolve to your function id native domain. You should use a CNAME domain record that point to your native function domain_name for it.

    Important Updates to function_id or hostname will recreate the domain.

    region String
    (Defaults to provider region) The region in where the domain was created.
    url String
    The URL that triggers the function
    functionId string
    The ID of the function you want to create a domain with.
    hostname string

    The hostname that should resolve to your function id native domain. You should use a CNAME domain record that point to your native function domain_name for it.

    Important Updates to function_id or hostname will recreate the domain.

    region string
    (Defaults to provider region) The region in where the domain was created.
    url string
    The URL that triggers the function
    function_id str
    The ID of the function you want to create a domain with.
    hostname str

    The hostname that should resolve to your function id native domain. You should use a CNAME domain record that point to your native function domain_name for it.

    Important Updates to function_id or hostname will recreate the domain.

    region str
    (Defaults to provider region) The region in where the domain was created.
    url str
    The URL that triggers the function
    functionId String
    The ID of the function you want to create a domain with.
    hostname String

    The hostname that should resolve to your function id native domain. You should use a CNAME domain record that point to your native function domain_name for it.

    Important Updates to function_id or hostname will recreate the domain.

    region String
    (Defaults to provider region) The region in where the domain was created.
    url String
    The URL that triggers the function

    Import

    Domain can be imported using the {region}/{id}, e.g.

    bash

    $ pulumi import scaleway:index/functionDomain:FunctionDomain main fr-par/11111111-1111-1111-1111-111111111111
    

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

    Package Details

    Repository
    scaleway pulumiverse/pulumi-scaleway
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scaleway Terraform Provider.
    scaleway logo
    Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse