User Tools

Site Tools


cloud:oracle_bmcs:terraform

This is an old revision of the document!


  1. Install terraform. Dowload binary tarball from https://www.terraform.io/downloads.html, copy terraform to /usr/local/bin
  2. Download oracle bmcs terraform provider https://github.com/oracle/terraform-provider-baremetal
  3. Configure bmcs provider for terraform. Create ~/.terraformrc
    providers {
      baremetal = "~/dev/terraform-provider-baremetal"
      }
  4. Download bmcs terraform provider source, will use the sample instance resource tf files.
    $ mkdir -p ~/dev/terraform
    $ cd ~/dev/terraform
    $ git clone https://github.com/oracle/terraform-provider-baremetal.git
    $ cp -a terraform-provider-baremetal/docs/examples/compute/single_instance .
    $ cd single_instance
  5. Edit env-vars
    ### Authentication details
    export TF_VAR_tenancy_ocid=ocid1.tenancy.oc1..aaaaaaaaunn55c5wycmmr6i23saassro6fimf5gsxiye7ibh3x53y3fuldhq
    # user frank
    #export TF_VAR_user_ocid=ocid1.user.oc1..aaaaaaaatpooulnfgj6na62xdxzl2xpiy45wnmyewuycyjfsxsux7ieazclq #frank frank.deng: ocid1.user.oc1..aaaaaaaanusjfetj7kzp73haciwlevxjzyms7sxrtzbewl2y3z2xltnjcjpq
    # user frank.deng@oracle.com (admin)
    export TF_VAR_user_ocid=ocid1.user.oc1..aaaaaaaanusjfetj7kzp73haciwlevxjzyms7sxrtzbewl2y3z2xltnjcjpq
    export TF_VAR_fingerprint=03:3d:bb:1d:fd:e5:5a:68:7d:ae:62:9a:5b:c6:6a:49
    export TF_VAR_private_key_path=~/.oraclebmc/bmcs_api_key.pem
    
    ### Region
    export TF_VAR_region="us-ashburn-1"
    
    ### Compartment
    export TF_VAR_compartment_ocid=$C
    
    ### Public/private keys used on the instance
    export TF_VAR_ssh_public_key=$(cat ~/.ssh/id_rsa_mine.pub)
    export TF_VAR_ssh_private_key=$(cat ~/.ssh/id_rsa_mine)
    
    ## Specific to this example
    ### Choose a subnet that exists in the AD and compartment you are launching the instance in
    export TF_VAR_SubnetOCID="ocid1.subnet.oc1.iad.aaaaaaaaravcsmdmj3gksfn6ft36lzl3z75b325ol5ifgrd5sfldvgcrfyqq"
  6. Run “terraform plan”
  7. Run “terraform apply”
  8. To destroy the deployment, run “terraform plan -destroy” and “terraform destroy”
cloud/oracle_bmcs/terraform.1501542841.txt.gz · Last modified: 2017/07/31 16:14 by frank