Skip to content

Instantly share code, notes, and snippets.

@brunoborges
Created April 24, 2017 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunoborges/2b9aeccf88cb83c6205a7b55ee79130e to your computer and use it in GitHub Desktop.
Save brunoborges/2b9aeccf88cb83c6205a7b55ee79130e to your computer and use it in GitHub Desktop.
provider "opc" {
  identity_domain = "mydomain"
  endpoint        = "https://api-z27.compute.us6.oraclecloud.com/"
  user            = "user.name@example.com"
  password        = "Pa$$w0rd"
}
 
resource "opc_compute_ssh_key" "sshkey1" {
  name = "example-sshkey1"
  key = "${file("~/.ssh/id_rsa.pub")}"
}
 
resource "opc_compute_instance" "instance1" {
  name = "example-instance1"
  shape = "oc3"
  image_list = "/oracle/public/OL_7.2_UEKR3_x86_64"
  ssh_keys = [ "${opc_compute_ssh_key.sshkey1.name}" ]
  networking_info {
    index = 0
    shared_network = true
    nat = ["${opc_compute_ip_reservation.ipreservation1.name}"]
  }
}
 
resource "opc_compute_ip_reservation" "ipreservation1" {
  name = "example-ipreservation1"
  parent_pool = "/oracle/public/ippool"
  permanent = true
}
 
output "public_ip" {
  value = "${opc_compute_ip_reservation.ipreservation1.ip}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment