Created
December 29, 2015 10:08
-
-
Save rstarmer/fddbbffb4c41d66879f4 to your computer and use it in GitHub Desktop.
Terraform .tf file to create a single VM in OpenStack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a Virtual Machine | |
# For OpenStack, as with Digital Ocean, access credentials are needed | |
# They can be provided in a fashion similar to DO, passed as variables | |
# or via the terraform CLI as parameters, but they also can be passed | |
# as environment variables. The standard "openrc.sh" file includes | |
# all the prerequisite parameters including OS_AUTH_URL, OS_PASSWORD | |
# OS_USERNAME, OS_TENANT_NAME, and OS_REGION_NAME. The simplest is | |
# often to source the openrc file to set these variables, or set them | |
# in the provdier as follows: | |
#provider "openstack" { | |
# user_name = "admin" | |
# tenant_name = "admin" | |
# password = "pwd" | |
# auth_url = "http://myauthurl:5000/v2.0" | |
#} | |
resource "openstack_compute_instance_v2" "ruby-os" { | |
name = "ruby-os.opsits.com" | |
image_id = "7f85f7b3-eb20-4bef-8bad-bb3583a9a2fd" | |
flavor_id = "3" | |
key_pair = "rhs" | |
provisioner "local-exec" { | |
command = "echo ${openstack_compute_instance_v2.ruby-os.access_ip_v4} ansible_connection=ssh ansible_ssh_user=centos >> inventory" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment