20 lines
851 B
Terraform
20 lines
851 B
Terraform
|
# Creating an SSH key pair resource
|
||
|
resource "openstack_compute_keypair_v2" "test_keypair" {
|
||
|
provider = openstack.ovh # Provider name declared in provider.tf
|
||
|
name = "test_keypair" # Name of the SSH key to use for creation
|
||
|
public_key = file("~/.ssh/aravinth.pub") # Path to your previously generated SSH key
|
||
|
}
|
||
|
|
||
|
# Creating the instance
|
||
|
resource "openstack_compute_instance_v2" "test_terraform_instance" {
|
||
|
name = "dolibarr.playground.libre-solutions.com" # Instance name
|
||
|
provider = openstack.ovh # Provider name
|
||
|
image_name = "Debian 12" # Image name
|
||
|
flavor_name = "d2-2" # Instance type name
|
||
|
# Name of openstack_compute_keypair_v2 resource named keypair_test
|
||
|
key_pair = openstack_compute_keypair_v2.test_keypair.name
|
||
|
network {
|
||
|
name = "Ext-Net" # Adds the network component to reach your instance
|
||
|
}
|
||
|
}
|