Skip to content

Instantly share code, notes, and snippets.

@fsamin
Created April 6, 2017 18:41
Show Gist options
  • Save fsamin/bfb0ab1008d6aa54957a8091d458e86b to your computer and use it in GitHub Desktop.
Save fsamin/bfb0ab1008d6aa54957a8091d458e86b to your computer and use it in GitHub Desktop.
pci.tf
# Configure the OpenStack Provider
provider "openstack" {
# user_name = "" OS_USERNAME sourced from openrc.sh file will be used
# password = "" OS_PASSWORD sourced from openrc.sh file will be used
tenant_name = "TENANT_NAME"
auth_url = "https://auth.cloud.ovh.net/v2.0/"
}
# Create a key pair
resource "openstack_compute_keypair_v2" "test-keypair" {
name = "my-keypair"
public_key = "ssh-rsa blablablablablablablablablabla...."
}
# Create a server
resource "openstack_compute_instance_v2" "test-server" {
name = "test-server"
region = "GRA1"
image_name = "Debian 8"
flavor_name = "vps-ssd-1"
key_pair = "my-keypair"
}
# Create a attached volume on 1 GB
resource "openstack_blockstorage_volume_v1" "attached-volume" {
name = "attached-volume"
size = 1
}
# Create a server with an attached volume
resource "openstack_compute_instance_v2" "test-server-volume" {
name = "test-server-volume"
region = "GRA1"
image_name = "Debian 8"
flavor_name = "vps-ssd-1"
key_pair = "my-keypair"
volume {
volume_id = "${openstack_blockstorage_volume_v1.attached-volume.id}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment