netbox.ConfigTemplate
Explore with Pulumi AI
From the official documentation:
Configuration templates can be used to render device configurations from context data. Templates are written in the Jinja2 language and can be associated with devices roles, platforms, and/or individual devices.
Context data is made available to devices and/or virtual machines based on their relationships to other objects in NetBox. For example, context data can be associated only with devices assigned to a particular site, or only to virtual machines in a certain cluster.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";
const test = new netbox.ConfigTemplate("test", {
description: "test description",
templateCode: "hostname {{ name }}",
environmentParams: JSON.stringify({
name: "my-hostname",
}),
});
import pulumi
import json
import pulumi_netbox as netbox
test = netbox.ConfigTemplate("test",
description="test description",
template_code="hostname {{ name }}",
environment_params=json.dumps({
"name": "my-hostname",
}))
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v3/netbox"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"name": "my-hostname",
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = netbox.NewConfigTemplate(ctx, "test", &netbox.ConfigTemplateArgs{
Description: pulumi.String("test description"),
TemplateCode: pulumi.String("hostname {{ name }}"),
EnvironmentParams: pulumi.String(json0),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Netbox = Pulumi.Netbox;
return await Deployment.RunAsync(() =>
{
var test = new Netbox.ConfigTemplate("test", new()
{
Description = "test description",
TemplateCode = "hostname {{ name }}",
EnvironmentParams = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["name"] = "my-hostname",
}),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.ConfigTemplate;
import com.pulumi.netbox.ConfigTemplateArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 test = new ConfigTemplate("test", ConfigTemplateArgs.builder()
.description("test description")
.templateCode("hostname {{ name }}")
.environmentParams(serializeJson(
jsonObject(
jsonProperty("name", "my-hostname")
)))
.build());
}
}
resources:
test:
type: netbox:ConfigTemplate
properties:
description: test description
templateCode: hostname {{ name }}
environmentParams:
fn::toJSON:
name: my-hostname
Create ConfigTemplate Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ConfigTemplate(name: string, args: ConfigTemplateArgs, opts?: CustomResourceOptions);
@overload
def ConfigTemplate(resource_name: str,
args: ConfigTemplateArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ConfigTemplate(resource_name: str,
opts: Optional[ResourceOptions] = None,
template_code: Optional[str] = None,
config_template_id: Optional[str] = None,
description: Optional[str] = None,
environment_params: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[Sequence[str]] = None)
func NewConfigTemplate(ctx *Context, name string, args ConfigTemplateArgs, opts ...ResourceOption) (*ConfigTemplate, error)
public ConfigTemplate(string name, ConfigTemplateArgs args, CustomResourceOptions? opts = null)
public ConfigTemplate(String name, ConfigTemplateArgs args)
public ConfigTemplate(String name, ConfigTemplateArgs args, CustomResourceOptions options)
type: netbox:ConfigTemplate
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 ConfigTemplateArgs
- 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 ConfigTemplateArgs
- 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 ConfigTemplateArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ConfigTemplateArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ConfigTemplateArgs
- 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 configTemplateResource = new Netbox.ConfigTemplate("configTemplateResource", new()
{
TemplateCode = "string",
ConfigTemplateId = "string",
Description = "string",
EnvironmentParams = "string",
Name = "string",
Tags = new[]
{
"string",
},
});
example, err := netbox.NewConfigTemplate(ctx, "configTemplateResource", &netbox.ConfigTemplateArgs{
TemplateCode: pulumi.String("string"),
ConfigTemplateId: pulumi.String("string"),
Description: pulumi.String("string"),
EnvironmentParams: pulumi.String("string"),
Name: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
})
var configTemplateResource = new ConfigTemplate("configTemplateResource", ConfigTemplateArgs.builder()
.templateCode("string")
.configTemplateId("string")
.description("string")
.environmentParams("string")
.name("string")
.tags("string")
.build());
config_template_resource = netbox.ConfigTemplate("configTemplateResource",
template_code="string",
config_template_id="string",
description="string",
environment_params="string",
name="string",
tags=["string"])
const configTemplateResource = new netbox.ConfigTemplate("configTemplateResource", {
templateCode: "string",
configTemplateId: "string",
description: "string",
environmentParams: "string",
name: "string",
tags: ["string"],
});
type: netbox:ConfigTemplate
properties:
configTemplateId: string
description: string
environmentParams: string
name: string
tags:
- string
templateCode: string
ConfigTemplate 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 ConfigTemplate resource accepts the following input properties:
- Template
Code string - Config
Template stringId - The ID of this resource.
- Description string
- Environment
Params string - Defaults to
{}
. - Name string
- List<string>
- Template
Code string - Config
Template stringId - The ID of this resource.
- Description string
- Environment
Params string - Defaults to
{}
. - Name string
- []string
- template
Code String - config
Template StringId - The ID of this resource.
- description String
- environment
Params String - Defaults to
{}
. - name String
- List<String>
- template
Code string - config
Template stringId - The ID of this resource.
- description string
- environment
Params string - Defaults to
{}
. - name string
- string[]
- template_
code str - config_
template_ strid - The ID of this resource.
- description str
- environment_
params str - Defaults to
{}
. - name str
- Sequence[str]
- template
Code String - config
Template StringId - The ID of this resource.
- description String
- environment
Params String - Defaults to
{}
. - name String
- List<String>
Outputs
All input properties are implicitly available as output properties. Additionally, the ConfigTemplate 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 ConfigTemplate Resource
Get an existing ConfigTemplate 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?: ConfigTemplateState, opts?: CustomResourceOptions): ConfigTemplate
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
config_template_id: Optional[str] = None,
description: Optional[str] = None,
environment_params: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[Sequence[str]] = None,
template_code: Optional[str] = None) -> ConfigTemplate
func GetConfigTemplate(ctx *Context, name string, id IDInput, state *ConfigTemplateState, opts ...ResourceOption) (*ConfigTemplate, error)
public static ConfigTemplate Get(string name, Input<string> id, ConfigTemplateState? state, CustomResourceOptions? opts = null)
public static ConfigTemplate get(String name, Output<String> id, ConfigTemplateState state, CustomResourceOptions options)
resources: _: type: netbox:ConfigTemplate 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.
- Config
Template stringId - The ID of this resource.
- Description string
- Environment
Params string - Defaults to
{}
. - Name string
- List<string>
- Template
Code string
- Config
Template stringId - The ID of this resource.
- Description string
- Environment
Params string - Defaults to
{}
. - Name string
- []string
- Template
Code string
- config
Template StringId - The ID of this resource.
- description String
- environment
Params String - Defaults to
{}
. - name String
- List<String>
- template
Code String
- config
Template stringId - The ID of this resource.
- description string
- environment
Params string - Defaults to
{}
. - name string
- string[]
- template
Code string
- config_
template_ strid - The ID of this resource.
- description str
- environment_
params str - Defaults to
{}
. - name str
- Sequence[str]
- template_
code str
- config
Template StringId - The ID of this resource.
- description String
- environment
Params String - Defaults to
{}
. - name String
- List<String>
- template
Code String
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the
netbox
Terraform Provider.