Provider Configuration

Initialize and configure the CloudNexus Terraform provider for infrastructure deployment

UTF-8 • Terraform HCL
1# CloudNexus Provider Configuration
2terraform {
3 required_version = ">= 1.5.0"
4
5 required_providers {
6 cloudnexus = {
7 source = "cloudnexus/cloudnexus"
8 version = "~> 3.2"
9 }
10 }
11}
12
13provider "cloudnexus" {
14 api_token = var.cn_api_token
15 region = "us-east-1"
16 project_id = "proj_8x29k1m"
17}
18
19# Compute Instance
20resource "cloudnexus_instance" "web_server" {
21 name = "production-app-01"
22 instance_type = "cn-standard-8"
23 image = "ubuntu-22.04-lts"
24 network_id = cloudnexus_network.main.id
25 boot_volume_size = 100
26
27 user_data = file("./scripts/init.sh")
28}
Resource State ● Synced
cloudnexus_instance
web_server
Running
IP: 10.0.4.22 8 vCPU 100GB NVMe
cloudnexus_network
main
Active
VPC: vpc-9f2a1b us-east-1
cloudnexus_database
postgres_primary
Planned
16GB RAM HA: Enabled
cloudnexus_firewall
web_ingress
Drift
Ports: 80, 443 Source: 0.0.0.0/0
Execution Log
terraform init -upgrade
Initializing the backend... Initializing provider plugins... - Finding cloudnexus/cloudnexus versions matching "~> 3.2"... - Installing cloudnexus/cloudnexus v3.2.1... - Installed cloudnexus/cloudnexus v3.2.1 (signed by CloudNexus Inc.) Terraform has been successfully initialized!
terraform plan -out=tfplan
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create ~ update in-place - destroy Terraform will perform the following actions: # cloudnexus_instance.web_server will be created + resource "cloudnexus_instance" "web_server" { + boot_volume_size = 100 + image = "ubuntu-22.04-lts" + instance_type = "cn-standard-8" + name = "production-app-01" + id = (known after apply) } Plan: 1 to add, 1 to change, 0 to destroy.