Prepare your environment
Install required tools
- Install Terraform.
-
Install jq:
-
Install and configure the Nebius AI Cloud CLI.
The CLI and
jqare only required for the example below.
Configure access and credentials
In the example below, Terraform applies configurations on behalf of a Nebius AI Cloud service account. Alternatively, you can authenticate with your user account. To configure access for the service account:-
Create a service account and save its ID to an environment variable:
-
Grant edit access to the service account:
- Get the tenant ID.
-
Get the ID of the default
editorsgroup:If you need to manage the Nebius AI Cloud resources by using the service account, use theadminsgroup instead ofeditors. Specify--name adminsin the command below. -
Add the service account to the group:
-
Create an authorized key:
-
Generate a key pair:
-
Upload a public key to create the authorized key and save its ID to an environment variable:
-
Generate a key pair:
Initialize a working directory
The configuration files for each infrastructure that you deploy with Terraform should be in their own working directory. This is where you will run the Terraform CLI commands. Before creating configuration files that define cloud resources, initialize the working directory:-
Create the working directory:
-
Inside the directory, create files that contain settings related to Terraform and its providers:
-
terraform.tflists the providers required for your configuration — in this case, the Nebius AI Cloud provider. -
providers.tfcontains settings for the provider.service_accountlists the environment variables that contain the credentials from the previous section.For more information, see authentication in the provider.
-
-
Run the initialization command in the directory:
Create resources
After your working directory is initialized, define and build your infrastructure:-
Inside the working directory, create configuration files. For example, create the following
main.tffile that sets up a registry in the Container Registry service:parent_id: Project ID. -
Validate the configuration:
If Terraform finds errors, the details are described in the output.
-
If the configuration is valid, apply it:
See also
- How to install the Terraform provider by Nebius AI Cloud
- Authentication in the Nebius AI Cloud provider for Terraform
InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.