Terraform provider reference / guides / import
Importing what you already have
Most projects do not start in Terraform. Everything the provider manages can be adopted instead of recreated, and the identifiers you need are the ones the API and the client area already show you.
What the identifier is
| Resource | Identifier to import |
|---|---|
fiberax_server |
the server number, e.g. 11199 |
fiberax_network |
the network number |
fiberax_ip |
the address number (not the address itself) |
fiberax_ssh_key |
the key number |
fiberax_network_interface |
<server>,<card>, e.g. 11199,net1 |
fiberax_server_firewall |
the server number - the firewall is a state OF a server |
fiberax_server_backup_policy |
the server number, for the same reason |
fiberax_disk |
<server>,<slot>, e.g. 11199,scsi1 |
Composite identifiers are separated by a comma, not a colon. Every resource page in this reference repeats its own identifier in an "Import" section, and that page is the authority if the two ever disagree.
The safe order
-
Write the resource block first, with at least the fields that cannot be guessed (
server_type_id,imageon a server). -
Import:
terraform import fiberax_server.app 11199
-
Run
terraform planand read it as a question, not as a task list. A plan that wants to change nothing means the configuration matches reality. A plan that wants to replace something means the configuration disagrees with the platform on a field that cannot be changed in place - fix the configuration, not the platform.
What commonly shows up in that first plan
- Size fields on a plan-based type. A type sold as plans sets cores, memory and disk from the
plan; writing them by hand makes the plan want a change forever. Leave them out and keep
plan_id. - The firewall. Import brings the rules in the order the platform holds them, and order is meaningful: the first matching rule wins. Copy the imported order into the configuration rather than tidying it.
- Addresses. A server created in the client area holds an address that has its own number. If
you want Terraform to manage it, import
fiberax_ipas well and reference it from the server instead of asking for a new one.
Importing a whole project at once
There is no single command for that, and the reason is not politeness: the provider cannot tell which of your existing servers you want managed. Import them one by one, starting with the ones you actually intend to change.
Generated from the provider schema for version 0.3.0. How to install the provider: Terraform provider.