Terraform provider reference / guides / account-keys
Projects with an account key
A project key belongs to ONE project. An account key belongs to the account: it orders and closes Virtual Data Center projects, issues keys of one project, and works inside any project of the account once the project is named. It is issued in the client area, section API tokens, Account keys, by the account owner only. Object storage projects are not reached by an account key.
1. Projects and their keys
With the account key in FIBERAX_TOKEN and no project_id, the provider manages the projects
themselves:
provider "fiberax" {}
resource "fiberax_project" "acme" {
name = "acme-production"
labels = ["customer-1042"]
}
resource "fiberax_project_token" "acme_ci" {
project_id = fiberax_project.acme.id
name = "acme ci"
scope = "rw"
expires_in_days = 90
}
Ordering is free; a new project is active within seconds, and the provider waits for it. The
secret of fiberax_project_token is kept in state (sensitive) - the platform shows it once. A key
issued this way works only while the account key that issued it works: revoking the account key in
the client area revokes these keys too, and the next plan issues them again.
2. Working inside a project
Servers, networks, addresses and every other project resource need the project named. Give each
project a provider configuration of its own with project_id; the provider sends it in the
Fiberax-Project header:
provider "fiberax" {
alias = "acme"
project_id = 4711
}
resource "fiberax_network" "backend" {
provider = fiberax.acme
name = "backend"
cidr = "10.20.0.0/24"
}
Without project_id such a resource answers project_required, and the provider says what to set.
The environment variable FIBERAX_PROJECT_ID sets the project for configurations that do not name it.
project_id must be known when the plan starts. A project created by fiberax_project in the same
run cannot feed it - the provider refuses with "The project is not known yet". Either create the
project first:
terraform apply -target=fiberax_project.acme terraform apply
or keep the projects in a configuration of their own and pass the ids in - as variables, or read
with the data source fiberax_projects (filtered by a label you set on the project). Do not give that
data source depends_on = [fiberax_project...]: Terraform then postpones reading it until apply
whenever the project changes, and project_id is unknown again.
3. Closing a project
Destroying fiberax_project closes the project for good, and only an empty one: no servers or
routers, no public IP addresses, no private networks besides the default one, no ISO images or server
images of your own. Otherwise the platform refuses and the provider names what is left; nothing is
closed. A resource inside the project is not linked to fiberax_project by project_id of its
provider configuration, so Terraform would destroy both at once and the project would be refused as
not empty. When one configuration holds the project and resources inside it, give those resources
depends_on = [fiberax_project.acme]: then destroy removes them first and closes the project last.
What the project ran up in the current period is invoiced when it closes.
Generated from the provider schema for version 0.11.0. How to install the provider: Terraform provider.