abikavi / terraform-provider-compute

Terraform Provider for Oracle Compute Cloud

Home Page:http://cloud.oracle.com/compute

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terraform Provider for Oracle Compute Cloud

THE PROVIDER PLUGIN IMPLEMENTATION IN THIS REPOSITORY IS DEPRECATED

For Terraform release 0.9.4 and onwards the Oracle Compute Cloud resouce provisioning is supported by the built-in Oracle Public Cloud opc provider included in the main Terraform distribution. See the Terraform Oracle Public Cloud Provider documentation for more details.

All future development and ongoing support for the built-in opc provider is at https://github.com/terraform-providers/terraform-provider-opc*

If you are still using Terraform 0.7.x to 0.9.3 the provider plugin in this repository is required to provision Oracle Compute Cloud resources. See the details below to build and install the provider plugin. See the migration guide to update existing configurations and deployments to the build-in provider for Terraform 0.9.4+

For the Terraform Provider for Oracle Bare Metal Cloud Services go to github.com/oracle/terraform-provider-baremetal

Requirements

Building

Create a directory where the provider will be built, and set the Go language GOPATH

$ export GOPATH=/home/opc/terraform-provider
$ cd $GOPATH

Fetch the source and build the provider.

$ go get -d github.com/oracle/terraform-provider-compute/provider
$ go build -o terraform-provider-opc github.com/oracle/terraform-provider-compute/provider

Usage

Add the generated terraform-provider-opc executable to your .terraformrc configuration (%APPDATA%/terraform.rc on Windows), e.g.

providers {
    opc = "/home/opc/terraform-provider/terraform-provider-opc"
}

To authenticate with the Oracle Compute Cloud the provider will prompt for the required environment credentials. These credentails can be set in the following environment variables:

  • OPC_ENDPOINT - Endpoint provided by Oracle Public Cloud (e.g. https://api-z13.compute.em2.oraclecloud.com/\)
  • OPC_USERNAME - Username for Oracle Public Cloud
  • OPC_PASSWORD - Password for Oracle Public Cloud
  • OPC_IDENTITY_DOMAIN - Identity domain for Oracle Public Cloud

or directly in the terraform configuration:

provider "opc" {
  user = "xxxx@xxx"
  password = "xxxx"
  identityDomain = "xxxx"
  endpoint = "https://api-z13.compute.em2.oraclecloud.com/"
}

Example Terraform configuration

An example test.tf is provided that demonstatates the basic usage of the Oracle Compute Cloud Terraform Provider.

$ cd $GOPATH/src/github.com/oracle/terraform-provider-compute/test
$ terraform plan
$ terraform apply
$ terraform destroy

Additional examples are in the examples directory.

Running the Integration Tests

An Oracle Compute Cloud Account is required to run the integration tests. The OCP_* variables must have been exported

$ cd $GOPATH/src/github.com/oracle/terraform-provider-compute/sdk/compute
$ go test

Common build issues

The following build issue can occur if you have an older version of the terraform executable installed.

Error configuring: 1 error(s) occurred:

* Incompatible API version with plugin. Plugin version: 3, Ours: 2

To build the provider plugin against a specific terraform version, checkout the version in the $GOPATH/src/github.com/hashicorp/terraform source directory and rebuild. Be sure the align the checkout tag with the version of terraform you have installed, e.g for Terraform v0.8.5 you will need to git checkout v0.8.5

$ terraform --version
Terraform v0.8.5

$ ( cd $GOPATH/src/github.com/hashicorp/terraform && git checkout v0.8.5 )
$ go build -o terraform-provider-opc github.com/oracle/terraform-provider-compute/provider

To revert back to building againt the latest source change the git checkout statement to git checkout master

About

Terraform Provider for Oracle Compute Cloud

http://cloud.oracle.com/compute

License:Mozilla Public License 2.0


Languages

Language:Go 99.1%Language:HCL 0.9%