scaleway.FunctionDomain
Explore with Pulumi AI
The scaleway.FunctionDomain
resource allows you to create and manage domain name bindings for Scaleway Serverless Functions.
Refer to the Functions domain documentation and the API documentation for more information.
Example Usage
This command allows to bind a custom domain name to a function.
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";
const mainFunctionNamespace = new scaleway.FunctionNamespace("main", {});
const mainFunction = new scaleway.Function("main", {
namespaceId: mainFunctionNamespace.id,
runtime: "go118",
privacy: "private",
handler: "Handle",
zipFile: "testfixture/gofunction.zip",
deploy: true,
});
const main = new scaleway.FunctionDomain("main", {
functionId: mainFunction.id,
hostname: "example.com",
}, {
dependsOn: [mainFunction],
});
import pulumi
import pulumiverse_scaleway as scaleway
main_function_namespace = scaleway.FunctionNamespace("main")
main_function = scaleway.Function("main",
namespace_id=main_function_namespace.id,
runtime="go118",
privacy="private",
handler="Handle",
zip_file="testfixture/gofunction.zip",
deploy=True)
main = scaleway.FunctionDomain("main",
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, "main", nil)
if err != nil {
return err
}
mainFunction, err := scaleway.NewFunction(ctx, "main", &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, "main", &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("main");
var mainFunction = new Scaleway.Function("main", new()
{
NamespaceId = mainFunctionNamespace.Id,
Runtime = "go118",
Privacy = "private",
Handler = "Handle",
ZipFile = "testfixture/gofunction.zip",
Deploy = true,
});
var main = new Scaleway.FunctionDomain("main", 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 main = new FunctionDomain("main", FunctionDomainArgs.builder()
.functionId(mainFunction.id())
.hostname("example.com")
.build(), CustomResourceOptions.builder()
.dependsOn(mainFunction)
.build());
}
}
resources:
main:
type: scaleway:FunctionDomain
properties:
functionId: ${mainFunction.id}
hostname: example.com
options:
dependson:
- ${mainFunction}
mainFunctionNamespace:
type: scaleway:FunctionNamespace
name: main
mainFunction:
type: scaleway:Function
name: main
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.
Constructor 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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The FunctionDomain resource accepts the following input properties:
- Function
Id string - The unique identifier of the function.
- Hostname string
The hostname with a CNAME record.
We recommend you use a CNAME domain record that point to your native function
domain_name
for it.Important Updating the
function_id
orhostname
arguments will recreate the domain.- Region string
- (Defaults to provider
region
) The region in which the domain was created.
- Function
Id string - The unique identifier of the function.
- Hostname string
The hostname with a CNAME record.
We recommend you use a CNAME domain record that point to your native function
domain_name
for it.Important Updating the
function_id
orhostname
arguments will recreate the domain.- Region string
- (Defaults to provider
region
) The region in which the domain was created.
- function
Id String - The unique identifier of the function.
- hostname String
The hostname with a CNAME record.
We recommend you use a CNAME domain record that point to your native function
domain_name
for it.Important Updating the
function_id
orhostname
arguments will recreate the domain.- region String
- (Defaults to provider
region
) The region in which the domain was created.
- function
Id string - The unique identifier of the function.
- hostname string
The hostname with a CNAME record.
We recommend you use a CNAME domain record that point to your native function
domain_name
for it.Important Updating the
function_id
orhostname
arguments will recreate the domain.- region string
- (Defaults to provider
region
) The region in which the domain was created.
- function_
id str - The unique identifier of the function.
- hostname str
The hostname with a CNAME record.
We recommend you use a CNAME domain record that point to your native function
domain_name
for it.Important Updating the
function_id
orhostname
arguments will recreate the domain.- region str
- (Defaults to provider
region
) The region in which the domain was created.
- function
Id String - The unique identifier of the function.
- hostname String
The hostname with a CNAME record.
We recommend you use a CNAME domain record that point to your native function
domain_name
for it.Important Updating the
function_id
orhostname
arguments will recreate the domain.- region String
- (Defaults to provider
region
) The region in which the domain was created.
Outputs
All input properties are implicitly available as output properties. Additionally, the FunctionDomain resource produces the following output properties:
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.
- Function
Id string - The unique identifier of the function.
- Hostname string
The hostname with a CNAME record.
We recommend you use a CNAME domain record that point to your native function
domain_name
for it.Important Updating the
function_id
orhostname
arguments will recreate the domain.- Region string
- (Defaults to provider
region
) The region in which the domain was created. - Url string
- The URL used to query the function.
- Function
Id string - The unique identifier of the function.
- Hostname string
The hostname with a CNAME record.
We recommend you use a CNAME domain record that point to your native function
domain_name
for it.Important Updating the
function_id
orhostname
arguments will recreate the domain.- Region string
- (Defaults to provider
region
) The region in which the domain was created. - Url string
- The URL used to query the function.
- function
Id String - The unique identifier of the function.
- hostname String
The hostname with a CNAME record.
We recommend you use a CNAME domain record that point to your native function
domain_name
for it.Important Updating the
function_id
orhostname
arguments will recreate the domain.- region String
- (Defaults to provider
region
) The region in which the domain was created. - url String
- The URL used to query the function.
- function
Id string - The unique identifier of the function.
- hostname string
The hostname with a CNAME record.
We recommend you use a CNAME domain record that point to your native function
domain_name
for it.Important Updating the
function_id
orhostname
arguments will recreate the domain.- region string
- (Defaults to provider
region
) The region in which the domain was created. - url string
- The URL used to query the function.
- function_
id str - The unique identifier of the function.
- hostname str
The hostname with a CNAME record.
We recommend you use a CNAME domain record that point to your native function
domain_name
for it.Important Updating the
function_id
orhostname
arguments will recreate the domain.- region str
- (Defaults to provider
region
) The region in which the domain was created. - url str
- The URL used to query the function.
- function
Id String - The unique identifier of the function.
- hostname String
The hostname with a CNAME record.
We recommend you use a CNAME domain record that point to your native function
domain_name
for it.Important Updating the
function_id
orhostname
arguments will recreate the domain.- region String
- (Defaults to provider
region
) The region in which the domain was created. - url String
- The URL used to query the function.
Import
Function domain binding can be imported using {region}/{id}
, as shown below:
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.