Terraform provider reference / resources / network_interface
fiberax_network_interface (Resource)
A network card of a server.
The card's network is a field of the card, not a separate resource: network_id for a private network of the project, or public = true to face the internet. One of the two is required, and together they are incompatible.
Cards the server is CREATED with are set by the networks field of the server itself; this resource describes cards added afterwards. The two cannot be mixed on one card: the server's field is not checked against reality and knows nothing about the cards of this resource.
Some changes restart a running server once: adding a card, moving it to another network and changing its addresses. Turning filtering on or off and disconnecting the card do not; removing a card without addresses does not either, removing one that carries addresses may.
Public addresses cost money, and after the card is removed they keep being billed. The details are in the description of the ips field.
Example Usage
# A private card: the server is attached to a network of the project.
resource "fiberax_network_interface" "internal" {
server_id = fiberax_server.app.id
network_id = fiberax_network.backend.id
}
# A public card with an address you already hold.
#
# Keep the address as a SEPARATE resource instead of asking the card for a new one:
# then its release is part of the configuration and visible in the plan. Removing the card does NOT
# release the address - it returns to the project's pool and you keep paying for it.
resource "fiberax_ip" "web" {
server_type_id = data.fiberax_server_type.cluster.id
}
resource "fiberax_network_interface" "external" {
server_id = fiberax_server.app.id
public = true
ips = [fiberax_ip.web.id]
}
# A card disconnected without being removed: the settings are kept, no traffic flows.
resource "fiberax_network_interface" "spare" {
server_id = fiberax_server.app.id
network_id = fiberax_network.backend.id
link_down = true
}
Schema
Required
server_id(Number) The server the card belongs to.
Optional
firewall(Boolean) Whether the firewall filters this card.
The flag and the rules themselves live apart: the rules are in the fiberax_server_firewall resource, and this flag decides whether they apply to this card. Only a public card is filtered, so on a private one the flag means nothing.
If the server's firewall is described by the fiberax_server_firewall resource, that resource sets the flag - when it turns the firewall on, the platform marks the public cards that exist at that moment. Setting the same thing in two places means a tug of war: the two will keep overwriting each other on every run.
The other side of it: a card added AFTER the policy was applied does not get the mark and stays unfiltered. That is where this flag comes in handy - or apply the firewall policy again.
ips(Set of Number) Public addresses the card should carry, by the IDs of thefiberax_ipresources. Only for a public card - on a private one the field is refused.
TAKING AN ADDRESS OFF THE CARD DOES NOT RELEASE IT. It returns to the project's pool and keeps being billed until it is released explicitly - by destroying its fiberax_ip resource or deleting it through the API. Destroying the server is different: a server created with public_ipv4 = { new = true } releases its addresses to the platform's shared pool (provider 0.7.0 and later; 0.6.0 and earlier send no choice, and the platform then releases every address of the server), while one with id or reuse = true keeps them with the project. Hold addresses with the fiberax_ip resource: then releasing them is in the configuration and visible in the plan.
A set, not a list: the order of addresses on a card means nothing.
link_down(Boolean) Set true to disconnect the card without removing it: the settings are kept, traffic does not flow.
The platform always brings a fresh card up, so when a disconnected card is created the provider applies this field with a second request - the same one that puts the addresses on.
network_id(Number) Private network the card is attached to. Changing it MOVES the card to another network instead of recreating it.
Incompatible with public = true.
public(Boolean) Whether the card faces the internet.
A card CREATED public without ips gets no address - list one in ips to have it reachable.
An existing card TURNED public must name its address in ips. The platform would otherwise allocate a new, billed address that this configuration does not hold, so the provider refuses such a change at plan time. Hold the address with the fiberax_ip resource and list its id.
Read-Only
id(String) Slot name (net1). Assigned by the platform - it picks a free slot itself.mac(String) Hardware address. Assigned by the hypervisor.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
# The import ID for a card is the server ID and the slot name, separated by a comma. terraform import fiberax_network_interface.internal 10867,net1
Generated from the provider schema for version 0.11.0. How to install the provider: Terraform provider.