netbox.Service
Explore with Pulumi AI
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
andsctp
. - Custom
Fields Dictionary<string, string> - Description string
- Device
Id double - Exactly one of
virtual_machine_id
ordevice_id
must be given. - Name string
- Port double
- Exactly one of
port
orports
must be given. - Ports List<double>
- Exactly one of
port
orports
must be given. - Service
Id string - The ID of this resource.
- List<string>
- Virtual
Machine doubleId - Exactly one of
virtual_machine_id
ordevice_id
must be given.
- Protocol string
- Valid values are
tcp
,udp
andsctp
. - Custom
Fields map[string]string - Description string
- Device
Id float64 - Exactly one of
virtual_machine_id
ordevice_id
must be given. - Name string
- Port float64
- Exactly one of
port
orports
must be given. - Ports []float64
- Exactly one of
port
orports
must be given. - Service
Id string - The ID of this resource.
- []string
- Virtual
Machine float64Id - Exactly one of
virtual_machine_id
ordevice_id
must be given.
- protocol String
- Valid values are
tcp
,udp
andsctp
. - custom
Fields Map<String,String> - description String
- device
Id Double - Exactly one of
virtual_machine_id
ordevice_id
must be given. - name String
- port Double
- Exactly one of
port
orports
must be given. - ports List<Double>
- Exactly one of
port
orports
must be given. - service
Id String - The ID of this resource.
- List<String>
- virtual
Machine DoubleId - Exactly one of
virtual_machine_id
ordevice_id
must be given.
- protocol string
- Valid values are
tcp
,udp
andsctp
. - custom
Fields {[key: string]: string} - description string
- device
Id number - Exactly one of
virtual_machine_id
ordevice_id
must be given. - name string
- port number
- Exactly one of
port
orports
must be given. - ports number[]
- Exactly one of
port
orports
must be given. - service
Id string - The ID of this resource.
- string[]
- virtual
Machine numberId - Exactly one of
virtual_machine_id
ordevice_id
must be given.
- protocol str
- Valid values are
tcp
,udp
andsctp
. - custom_
fields Mapping[str, str] - description str
- device_
id float - Exactly one of
virtual_machine_id
ordevice_id
must be given. - name str
- port float
- Exactly one of
port
orports
must be given. - ports Sequence[float]
- Exactly one of
port
orports
must be given. - service_
id str - The ID of this resource.
- Sequence[str]
- virtual_
machine_ floatid - Exactly one of
virtual_machine_id
ordevice_id
must be given.
- protocol String
- Valid values are
tcp
,udp
andsctp
. - custom
Fields Map<String> - description String
- device
Id Number - Exactly one of
virtual_machine_id
ordevice_id
must be given. - name String
- port Number
- Exactly one of
port
orports
must be given. - ports List<Number>
- Exactly one of
port
orports
must be given. - service
Id String - The ID of this resource.
- List<String>
- virtual
Machine NumberId - Exactly one of
virtual_machine_id
ordevice_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.
- Custom
Fields Dictionary<string, string> - Description string
- Device
Id double - Exactly one of
virtual_machine_id
ordevice_id
must be given. - Name string
- Port double
- Exactly one of
port
orports
must be given. - Ports List<double>
- Exactly one of
port
orports
must be given. - Protocol string
- Valid values are
tcp
,udp
andsctp
. - Service
Id string - The ID of this resource.
- List<string>
- Virtual
Machine doubleId - Exactly one of
virtual_machine_id
ordevice_id
must be given.
- Custom
Fields map[string]string - Description string
- Device
Id float64 - Exactly one of
virtual_machine_id
ordevice_id
must be given. - Name string
- Port float64
- Exactly one of
port
orports
must be given. - Ports []float64
- Exactly one of
port
orports
must be given. - Protocol string
- Valid values are
tcp
,udp
andsctp
. - Service
Id string - The ID of this resource.
- []string
- Virtual
Machine float64Id - Exactly one of
virtual_machine_id
ordevice_id
must be given.
- custom
Fields Map<String,String> - description String
- device
Id Double - Exactly one of
virtual_machine_id
ordevice_id
must be given. - name String
- port Double
- Exactly one of
port
orports
must be given. - ports List<Double>
- Exactly one of
port
orports
must be given. - protocol String
- Valid values are
tcp
,udp
andsctp
. - service
Id String - The ID of this resource.
- List<String>
- virtual
Machine DoubleId - Exactly one of
virtual_machine_id
ordevice_id
must be given.
- custom
Fields {[key: string]: string} - description string
- device
Id number - Exactly one of
virtual_machine_id
ordevice_id
must be given. - name string
- port number
- Exactly one of
port
orports
must be given. - ports number[]
- Exactly one of
port
orports
must be given. - protocol string
- Valid values are
tcp
,udp
andsctp
. - service
Id string - The ID of this resource.
- string[]
- virtual
Machine numberId - Exactly one of
virtual_machine_id
ordevice_id
must be given.
- custom_
fields Mapping[str, str] - description str
- device_
id float - Exactly one of
virtual_machine_id
ordevice_id
must be given. - name str
- port float
- Exactly one of
port
orports
must be given. - ports Sequence[float]
- Exactly one of
port
orports
must be given. - protocol str
- Valid values are
tcp
,udp
andsctp
. - service_
id str - The ID of this resource.
- Sequence[str]
- virtual_
machine_ floatid - Exactly one of
virtual_machine_id
ordevice_id
must be given.
- custom
Fields Map<String> - description String
- device
Id Number - Exactly one of
virtual_machine_id
ordevice_id
must be given. - name String
- port Number
- Exactly one of
port
orports
must be given. - ports List<Number>
- Exactly one of
port
orports
must be given. - protocol String
- Valid values are
tcp
,udp
andsctp
. - service
Id String - The ID of this resource.
- List<String>
- virtual
Machine NumberId - Exactly one of
virtual_machine_id
ordevice_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.