1. Packages
  2. Netbox Provider
  3. API Docs
  4. Service
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

netbox.Service

Explore with Pulumi AI

netbox logo
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

    From the official documentation:

    A service represents a layer four TCP or UDP service available on a device or virtual machine. For example, you might want to document that an HTTP service is running on a device. Each service includes a name, protocol, and port number; for example, “SSH (TCP/22)” or “DNS (UDP/53).”

    A service may optionally be bound to one or more specific IP addresses belonging to its parent device or VM. (If no IP addresses are bound, the service is assumed to be reachable via any assigned IP address.

    Create Service Resource

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

    Constructor syntax

    new Service(name: string, args: ServiceArgs, opts?: CustomResourceOptions);
    @overload
    def Service(resource_name: str,
                args: ServiceArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Service(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                protocol: Optional[str] = None,
                custom_fields: Optional[Mapping[str, str]] = None,
                description: Optional[str] = None,
                device_id: Optional[float] = None,
                name: Optional[str] = None,
                port: Optional[float] = None,
                ports: Optional[Sequence[float]] = None,
                service_id: Optional[str] = None,
                tags: Optional[Sequence[str]] = None,
                virtual_machine_id: Optional[float] = None)
    func NewService(ctx *Context, name string, args ServiceArgs, opts ...ResourceOption) (*Service, error)
    public Service(string name, ServiceArgs args, CustomResourceOptions? opts = null)
    public Service(String name, ServiceArgs args)
    public Service(String name, ServiceArgs args, CustomResourceOptions options)
    
    type: netbox:Service
    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 ServiceArgs
    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 ServiceArgs
    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 ServiceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceArgs
    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 serviceResource = new Netbox.Service("serviceResource", new()
    {
        Protocol = "string",
        CustomFields = 
        {
            { "string", "string" },
        },
        Description = "string",
        DeviceId = 0,
        Name = "string",
        Ports = new[]
        {
            0,
        },
        ServiceId = "string",
        Tags = new[]
        {
            "string",
        },
        VirtualMachineId = 0,
    });
    
    example, err := netbox.NewService(ctx, "serviceResource", &netbox.ServiceArgs{
    	Protocol: pulumi.String("string"),
    	CustomFields: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Description: pulumi.String("string"),
    	DeviceId:    pulumi.Float64(0),
    	Name:        pulumi.String("string"),
    	Ports: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	ServiceId: pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	VirtualMachineId: pulumi.Float64(0),
    })
    
    var serviceResource = new Service("serviceResource", ServiceArgs.builder()
        .protocol("string")
        .customFields(Map.of("string", "string"))
        .description("string")
        .deviceId(0)
        .name("string")
        .ports(0)
        .serviceId("string")
        .tags("string")
        .virtualMachineId(0)
        .build());
    
    service_resource = netbox.Service("serviceResource",
        protocol="string",
        custom_fields={
            "string": "string",
        },
        description="string",
        device_id=0,
        name="string",
        ports=[0],
        service_id="string",
        tags=["string"],
        virtual_machine_id=0)
    
    const serviceResource = new netbox.Service("serviceResource", {
        protocol: "string",
        customFields: {
            string: "string",
        },
        description: "string",
        deviceId: 0,
        name: "string",
        ports: [0],
        serviceId: "string",
        tags: ["string"],
        virtualMachineId: 0,
    });
    
    type: netbox:Service
    properties:
        customFields:
            string: string
        description: string
        deviceId: 0
        name: string
        ports:
            - 0
        protocol: string
        serviceId: string
        tags:
            - string
        virtualMachineId: 0
    

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

    Protocol string
    Valid values are tcp, udp and sctp.
    CustomFields Dictionary<string, string>
    Description string
    DeviceId double
    Exactly one of virtual_machine_id or device_id must be given.
    Name string
    Port double
    Exactly one of port or ports must be given.

    Deprecated: Deprecated

    Ports List<double>
    Exactly one of port or ports must be given.
    ServiceId string
    The ID of this resource.
    Tags List<string>
    VirtualMachineId double
    Exactly one of virtual_machine_id or device_id must be given.
    Protocol string
    Valid values are tcp, udp and sctp.
    CustomFields map[string]string
    Description string
    DeviceId float64
    Exactly one of virtual_machine_id or device_id must be given.
    Name string
    Port float64
    Exactly one of port or ports must be given.

    Deprecated: Deprecated

    Ports []float64
    Exactly one of port or ports must be given.
    ServiceId string
    The ID of this resource.
    Tags []string
    VirtualMachineId float64
    Exactly one of virtual_machine_id or device_id must be given.
    protocol String
    Valid values are tcp, udp and sctp.
    customFields Map<String,String>
    description String
    deviceId Double
    Exactly one of virtual_machine_id or device_id must be given.
    name String
    port Double
    Exactly one of port or ports must be given.

    Deprecated: Deprecated

    ports List<Double>
    Exactly one of port or ports must be given.
    serviceId String
    The ID of this resource.
    tags List<String>
    virtualMachineId Double
    Exactly one of virtual_machine_id or device_id must be given.
    protocol string
    Valid values are tcp, udp and sctp.
    customFields {[key: string]: string}
    description string
    deviceId number
    Exactly one of virtual_machine_id or device_id must be given.
    name string
    port number
    Exactly one of port or ports must be given.

    Deprecated: Deprecated

    ports number[]
    Exactly one of port or ports must be given.
    serviceId string
    The ID of this resource.
    tags string[]
    virtualMachineId number
    Exactly one of virtual_machine_id or device_id must be given.
    protocol str
    Valid values are tcp, udp and sctp.
    custom_fields Mapping[str, str]
    description str
    device_id float
    Exactly one of virtual_machine_id or device_id must be given.
    name str
    port float
    Exactly one of port or ports must be given.

    Deprecated: Deprecated

    ports Sequence[float]
    Exactly one of port or ports must be given.
    service_id str
    The ID of this resource.
    tags Sequence[str]
    virtual_machine_id float
    Exactly one of virtual_machine_id or device_id must be given.
    protocol String
    Valid values are tcp, udp and sctp.
    customFields Map<String>
    description String
    deviceId Number
    Exactly one of virtual_machine_id or device_id must be given.
    name String
    port Number
    Exactly one of port or ports must be given.

    Deprecated: Deprecated

    ports List<Number>
    Exactly one of port or ports must be given.
    serviceId String
    The ID of this resource.
    tags List<String>
    virtualMachineId Number
    Exactly one of virtual_machine_id or device_id must be given.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Service 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 Service Resource

    Get an existing Service 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?: ServiceState, opts?: CustomResourceOptions): Service
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            custom_fields: Optional[Mapping[str, str]] = None,
            description: Optional[str] = None,
            device_id: Optional[float] = None,
            name: Optional[str] = None,
            port: Optional[float] = None,
            ports: Optional[Sequence[float]] = None,
            protocol: Optional[str] = None,
            service_id: Optional[str] = None,
            tags: Optional[Sequence[str]] = None,
            virtual_machine_id: Optional[float] = None) -> Service
    func GetService(ctx *Context, name string, id IDInput, state *ServiceState, opts ...ResourceOption) (*Service, error)
    public static Service Get(string name, Input<string> id, ServiceState? state, CustomResourceOptions? opts = null)
    public static Service get(String name, Output<String> id, ServiceState state, CustomResourceOptions options)
    resources:  _:    type: netbox:Service    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.
    The following state arguments are supported:
    CustomFields Dictionary<string, string>
    Description string
    DeviceId double
    Exactly one of virtual_machine_id or device_id must be given.
    Name string
    Port double
    Exactly one of port or ports must be given.

    Deprecated: Deprecated

    Ports List<double>
    Exactly one of port or ports must be given.
    Protocol string
    Valid values are tcp, udp and sctp.
    ServiceId string
    The ID of this resource.
    Tags List<string>
    VirtualMachineId double
    Exactly one of virtual_machine_id or device_id must be given.
    CustomFields map[string]string
    Description string
    DeviceId float64
    Exactly one of virtual_machine_id or device_id must be given.
    Name string
    Port float64
    Exactly one of port or ports must be given.

    Deprecated: Deprecated

    Ports []float64
    Exactly one of port or ports must be given.
    Protocol string
    Valid values are tcp, udp and sctp.
    ServiceId string
    The ID of this resource.
    Tags []string
    VirtualMachineId float64
    Exactly one of virtual_machine_id or device_id must be given.
    customFields Map<String,String>
    description String
    deviceId Double
    Exactly one of virtual_machine_id or device_id must be given.
    name String
    port Double
    Exactly one of port or ports must be given.

    Deprecated: Deprecated

    ports List<Double>
    Exactly one of port or ports must be given.
    protocol String
    Valid values are tcp, udp and sctp.
    serviceId String
    The ID of this resource.
    tags List<String>
    virtualMachineId Double
    Exactly one of virtual_machine_id or device_id must be given.
    customFields {[key: string]: string}
    description string
    deviceId number
    Exactly one of virtual_machine_id or device_id must be given.
    name string
    port number
    Exactly one of port or ports must be given.

    Deprecated: Deprecated

    ports number[]
    Exactly one of port or ports must be given.
    protocol string
    Valid values are tcp, udp and sctp.
    serviceId string
    The ID of this resource.
    tags string[]
    virtualMachineId number
    Exactly one of virtual_machine_id or device_id must be given.
    custom_fields Mapping[str, str]
    description str
    device_id float
    Exactly one of virtual_machine_id or device_id must be given.
    name str
    port float
    Exactly one of port or ports must be given.

    Deprecated: Deprecated

    ports Sequence[float]
    Exactly one of port or ports must be given.
    protocol str
    Valid values are tcp, udp and sctp.
    service_id str
    The ID of this resource.
    tags Sequence[str]
    virtual_machine_id float
    Exactly one of virtual_machine_id or device_id must be given.
    customFields Map<String>
    description String
    deviceId Number
    Exactly one of virtual_machine_id or device_id must be given.
    name String
    port Number
    Exactly one of port or ports must be given.

    Deprecated: Deprecated

    ports List<Number>
    Exactly one of port or ports must be given.
    protocol String
    Valid values are tcp, udp and sctp.
    serviceId String
    The ID of this resource.
    tags List<String>
    virtualMachineId Number
    Exactly one of virtual_machine_id or device_id must be given.

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    netbox logo
    netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger