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 file env-vars
    ### Authentication details
    export TF_VAR_tenancy_ocid=ocid1.tenancy.oc1..aaaaaaaaunn55c5wycmmr6i23saassro6fimf5gsxiye7ibh3x53y3fuldhq
    # 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=ocid1.compartment.oc1..aaaaaaaazi6xt3lj6ugjnbsdf3egk7srjl7qcguxyft4afi26qmnvrwbiraq
    
    ### 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. Source env-vars “. ./env-vars”
  7. Run “terraform plan”
  8. Run “terraform apply”
  9. To destroy the deployment, run “terraform plan -destroy” and “terraform destroy”