Skip to content

Commit da1a5af

Browse files
Fixed some block volume issues
1 parent 717e968 commit da1a5af

File tree

23 files changed

+1567
-154
lines changed

23 files changed

+1567
-154
lines changed

LICENSE.md

Lines changed: 373 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 84 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,100 @@
1+
# ___ ____ _ ____ _ _____
2+
# / _ \| _ \ / \ / ___| | | ____|
3+
# | | | | |_) | / _ \| | | | | _|
4+
# | |_| | _ < / ___ | |___| |___| |___
5+
# \___/|_| \_/_/ \_\____|_____|_____|
6+
***
7+
# Terraform provider for Oracle Bare Metal Cloud Services
8+
Oracle customers now have access to an enterprise class, developer friendly orchestration tool they can use to manage [Oracle Bare Metal Cloud Service](https://cloud.oracle.com/en_US/bare-metal) resources as well as the [Oracle Compute Cloud](https://github.com/oracle/terraform-provider-compute).
9+
10+
This Terraform provider is OSS, available to all OBMCS customers at no charge.
11+
12+
### Coverage
13+
The Terraform provider provides coverage for the entire BMC API excluding the Load Balancer Service, expected March 1 2017.
14+
15+
## Getting started
16+
Be sure to read the FAQ and Writing Terraform configurations for OBMCS in [/docs](https://github.com/oracle/terraform-provider-baremetal/tree/master/docs).
17+
18+
### Install Terraform
19+
https://www.terraform.io/downloads.html
20+
21+
### Download the OBMCS Terraform provider binary
22+
Find the appropriate binary for [your platform here](https://github.com/oracle/terraform-provider-baremetal/releases), download it.
23+
24+
#### \*nix
25+
Create `~/.terraformrc` that specifies the path to the `baremetal` provider.
126
```
2-
__________ _____ __ .__
3-
\______ \_____ _______ ____ / \ _____/ |______ | |
4-
| | _/\__ \\_ __ \_/ __ \ / \ / \_/ __ \ __\__ \ | |
5-
| | \ / __ \| | \/\ ___// Y \ ___/| | / __ \| |__
6-
|______ /(____ /__| \___ >____|__ /\___ >__| (____ /____/
7-
\/ \/ \/ \/ \/ \/
27+
providers {
28+
baremetal = "<path_to_provider_binary>"
29+
}
830
```
9-
# Oracle BareMetal Terraform Provider ![](https://circleci.com/gh/MustWin/terraform-Oracle-BareMetal-Provider.svg?style=shield&circle-token=fa06ce2af6b594812e3a756f5451a9e101d7b9f5)
1031

11-
This repository contains the Terraform provider for the Oracle Bare Metal Iaas
32+
#### Windows
33+
Create `%APPDATA%/terraform.rc` that specifies the path to the `baremetal` provider.
34+
```
35+
providers {
36+
baremetal = "<path_to_provider_binary>"
37+
}
38+
```
39+
### Export credentials
40+
Required Keys and OCIDs - https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm
1241

13-
## Requirements
42+
If you primarily work in a single compartment consider exporting that compartment's OCID as well. Remember that the tenancy OCID is also the OCID of the root compartment.
1443

15-
* Terraform v0.6.16+
16-
* Oracle Bare Metal credentials (see below)
44+
#### \*nix
45+
In your ~/.bash_profile set these variables
46+
`export TF_VAR_tenancy_ocid=`
47+
`export TF_VAR_user_ocid=`
48+
`export TF_VAR_fingerprint=`
49+
`export TF_VAR_private_key_path=<fully qualified path>`
50+
`export TF_VAR_private_key_password=`
1751

18-
Credentials required:
19-
* Tenancy OCID
20-
* User OCID
21-
* API Key
52+
Don't forget to `source ~/.bash_profile` once you've set these.
2253

23-
Also you will be needing Terraform 0.6.16+
24-
[Terraform Install](https://www.terraform.io/intro/getting-started/install.html)
54+
#### Windows
55+
`setx TF_VAR_tenancy_ocid <value>`
56+
`setx TF_VAR_user_ocid <value>`
57+
`setx TF_VAR_fingerprint <value>`
58+
`setx TF_VAR_private_key_path <value>`
59+
`setx TF_VAR_private_key_password <value>`
2560

26-
## Usage
61+
The variables won't be set for the current session, exit the terminal and reopen.
2762

28-
**Terraform basics**
63+
## Deploy an example configuration
64+
Download the [VCN example configuration.](https://github.com/oracle/terraform-provider-baremetal/tree/master/docs/examples/simple_vcn)
2965

30-
* [Getting Started](https://www.terraform.io/intro/getting-started/install.html)
66+
Edit it to include the OCID of the compartment you want to create the VCN. Remember that the tenancy OCID is the compartment OCID of your root compartment.
3167

32-
**Provider Installation**
68+
You should always plan, then apply a configuration -
69+
```
70+
$ terraform plan ./simple_vcn
71+
# Make sure the plan looks right.
72+
$ terraform apply ./simple_vcn
73+
```
74+
## OBMC resource and datasource details
75+
https://github.com/oracle/terraform-provider-baremetal/tree/master/docs
3376

34-
To install the provider, put the binary somewhere on your filesystem then configure Terraform to be able to find it.
35-
The configuration where plugins are defined is ~/.terraformrc for Unix-like systems and %APPDATA%/terraform.rc for Windows.
77+
## Getting help
78+
You can file an issue against the project
79+
https://github.com/oracle/terraform-provider-baremetal/issues
3680

37-
```json
38-
providers {
39-
oraclebaremetal = "/path/to/plugin"
40-
}
41-
```
81+
or meet us in the OBMCS forums
82+
https://community.oracle.com/community/cloud_computing/bare-metal
83+
84+
## Known bugs
85+
### Key passphrase
86+
The private key you use for API access must have a passphrase to work with Terraform. You can add a passphrase to your existing key with `ssh-keygen -p -f <private key>`.
4287

43-
**Provider Datasources Documentation**
88+
If you don't want to apply a passphrase to the version of the key you don't use with Terraform you can copy the key first -
89+
```
90+
cp <private key> <private key>.pass
91+
ssh-keygen -p -f <private key>.pass
92+
```
93+
### DB Systems timeout
94+
DB Systems can take up to an hour to provision. Terraform times out after 5 minutes. Ensure the DB System is the last resource you provision in a configuration.
4495

45-
**Provider Resources Documentation**
46-
* [Object Storage: Bucket](./docs/resources/object_storage_bucket.md)
96+
### Block volumes
97+
The size of a block volume cannot be specified, volumes created by Terraform are 256GB.
4798

48-
## Development
49-
[**Developer Guide**](docs/development.md)
99+
#### About the provider
100+
This provider was written on behalf of Oracle by [MustWin.](http://mustwin.com/)

docs/FAQ.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# ___ ____ _ ____ _ _____
2+
# / _ \| _ \ / \ / ___| | | ____|
3+
# | | | | |_) | / _ \| | | | | _|
4+
# | |_| | _ < / ___ | |___| |___| |___
5+
# \___/|_| \_/_/ \_\____|_____|_____|
6+
***
7+
# FAQ for the Oracle Bare Metal Cloud Services Terraform provider
8+
9+
#### Q: What is the Oracle Bare Metal Cloud?
10+
https://cloud.oracle.com/en_US/bare-metal/architecture
11+
12+
#### Q: What is Terraform?
13+
Terraform is an orchestration engine and language that enables you to safely and predictably create, change, and improve production infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
14+
15+
#### Q: What is a Terraform provider?
16+
Terraform is agnostic to the underlying cloud platform, it implements this with the provider model. Providers are pieces of software that act as an interface between the Cloud provider and the Terraform engine. There is a list of additional providers here - https://www.terraform.io/docs/providers/.
17+
18+
#### Q: Can I use Terraform to manage my infrastructure in multiple clouds?
19+
Yes, Terraform supports configurations that can span multiple clouds and can allow you to manage infrastructure and resources in those clouds.
20+
21+
#### Q: What can I do with Terraform I can't do with the APIs?
22+
Terraform allows you to define infrastructure configurations and then have those configurations implemented/created by Terraform automatically. In this respect, you could compare Terraform to similar solutions like OpenStack Heat, AWS CloudFormation, and others. http://blog.scottlowe.org/2015/11/25/intro-to-terraform/
23+
24+
#### Q: Can I use Terraform to manage both Oracle Public Cloud and Oracle Bare Metal Cloud S?
25+
**Yes.** The Oracle Public Cloud Terraform provider is located here - https://github.com/oracle/terraform-provider-compute.
26+
See - http://darylscorner.com/2016/11/using-terraform-across-multiple-cloud-providers/ for examples of Terraform multi-cloud configurations.
27+
28+
#### Q: What happens if I change infrastructure I'm managing with Terraform outside of Terraform?
29+
The change you made outside of Terraform will be overwritten the next time you apply the configuration unless you add the `ignore_changes` parameter to the resource in the configuration file.
30+
31+
#### Q: How do I get help?
32+
You can file an issue against the project
33+
https://github.com/oracle/terraform-provider-baremetal/issues
34+
35+
or meet us in the OBMCS forums
36+
https://community.oracle.com/community/cloud_computing/bare-metal
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# ___ ____ _ ____ _ _____
2+
# / _ \| _ \ / \ / ___| | | ____|
3+
# | | | | |_) | / _ \| | | | | _|
4+
# | |_| | _ < / ___ | |___| |___| |___
5+
# \___/|_| \_/_/ \_\____|_____|_____|
6+
***
7+
# Writing Terraform configurations for the Oracle Bare Metal Cloud
8+
9+
### All about Terraform
10+
The Terraform book, https://terraformbook.com/
11+
12+
Scott Lowe writes a great blog, including this introduction to Terraform http://blog.scottlowe.org/2015/11/25/intro-to-terraform/
13+
14+
15+
#### Read the Terraform configuration documentation
16+
Overview - https://www.terraform.io/docs/configuration/index.html
17+
Configuration file syntax - https://www.terraform.io/docs/configuration/syntax.html
18+
Resources - https://www.terraform.io/docs/configuration/resources.html
19+
Outputs - https://www.terraform.io/docs/configuration/outputs.html
20+
Logging - https://www.terraform.io/docs/configuration/environment-variables.html
21+
Interpolation - https://www.terraform.io/docs/configuration/interpolation.html
22+
23+
## OBMC resource and datasource details
24+
https://github.com/oracle/terraform-provider-baremetal/tree/master/docs
25+
26+
## Overview
27+
In the simplest terms Terraform turns configurations into a set of API calls against OBMCS API endpoints. The configuration language closely follows but does not mimic the API. Once you understand how to abstract the API into the configuration language writing configuration files is easy.
28+
29+
## Configuration file requirements
30+
Every configuration file define the provider that will be used, the OBMCS provider is called 'baremetal'. You must also specify where to get the required authentication details. You should never directly specify these values in a configuration file. This syntax will source the values from environment variables as covered in the README.
31+
```
32+
variable "tenancy_ocid" {}
33+
variable "user_ocid" {}
34+
variable "fingerprint" {}
35+
variable "private_key" {}
36+
variable "private_key_path" {}
37+
38+
provider "baremetal" {
39+
tenancy_ocid = "${var.tenancy_ocid}"
40+
user_ocid = "${var.user_ocid}"
41+
fingerprint = "${var.fingerprint}"
42+
private_key = "${var.private_key}"
43+
private_key_path = "${var.private_key_path}"
44+
}
45+
```
46+
## CamelCase
47+
The OBMCS API uses CamelCase in multiple places. Terraform doesn't support CamelCase in configuration files so we've replaced it with underscores. For example -
48+
49+
OBMCS native API Terraform configuration
50+
---------------- -----------------------
51+
availabilityDomain availability_domain
52+
cidrBlock cidr_block
53+
compartmentId compartment_id
54+
routeTableId route_table_id
55+
securityListIds security_list_ids
56+
vcnId vcn_id
57+
58+
## Mutable resources -
59+
Terraform abstracts the create, modify, and delete functions of the API. For example if you use the 'baremetal_core_subnet' resource to create a subnet and later want to change the display name of the subnet all you need to do is change the name in the configuration file. Terraform will determine you are making a change to an existing resource and make the appropriate API calls. If you wanted to delete a subnet you just remove the subnet resource in the configuration file and Terraform will make the appropriate API calls.
60+
61+
This version of the provider supports these resources -
62+
```
63+
baremetal_core_console_history
64+
baremetal_core_cpe
65+
baremetal_core_dhcp_options
66+
baremetal_core_drg_attachment
67+
baremetal_core_drg
68+
baremetal_core_image
69+
baremetal_core_instance
70+
baremetal_core_internet_gateway
71+
baremetal_core_ipsec
72+
baremetal_core_route_table
73+
baremetal_core_subnet
74+
baremetal_core_virtual_network
75+
baremetal_core_volume_attachment
76+
baremetal_core_volume_backup
77+
baremetal_core_volume
78+
baremetal_identity_api_key
79+
baremetal_identity_compartment
80+
baremetal_identity_group
81+
baremetal_identity_policy
82+
baremetal_identity_ui_password
83+
baremetal_identity_user
84+
```
85+
86+
## Non-mutable data sources -
87+
Terraform supports collecting data from multiple sources to influence the application of a configuration. One of those data sources can be an existing Terraform managed OBMCS deployment.
88+
89+
This version of the provider supports these OBMCS data sources -
90+
```
91+
baremetal_core_console_history_data
92+
baremetal_core_cpes
93+
baremetal_core_dhcp_options
94+
baremetal_core_drg_attachments
95+
baremetal_core_drgs
96+
baremetal_core_images
97+
baremetal_core_instances
98+
baremetal_core_internet_gateways
99+
baremetal_core_ipsec_config
100+
baremetal_core_ipsec_connections
101+
baremetal_core_ipsec_status
102+
baremetal_core_route_tables
103+
baremetal_core_shape
104+
baremetal_core_subnets
105+
baremetal_core_virtual_networks
106+
baremetal_core_vnic_attachments
107+
baremetal_core_vnic
108+
baremetal_core_volume_attachments
109+
baremetal_core_volume_backups
110+
baremetal_core_volumes
111+
baremetal_identity_api_keys
112+
baremetal_identity_availability_domains
113+
```

docs/development.md

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
variable "tenancy_ocid" {}
2+
variable "user_ocid" {}
3+
variable "fingerprint" {}
4+
variable "private_key" {}
5+
variable "private_key_path" {}
6+
variable "compartment_ocid" {}
7+
8+
9+
provider "baremetal" {
10+
tenancy_ocid = "${var.tenancy_ocid}"
11+
user_ocid = "${var.user_ocid}"
12+
fingerprint = "${var.fingerprint}"
13+
private_key_path = "${var.private_key_path}"
14+
private_key = "${var.private_key}"
15+
}
16+
17+
resource "baremetal_database_db_system" "dev_db_1" {
18+
availability_domain = "Uocm:PHX-AD-1"
19+
compartment_id = "${var.compartment_ocid}"
20+
cpu_core_count = 2
21+
database_edition = "ENTERPRISE_EDITION"
22+
db_home {
23+
database {
24+
"admin_password" = "BEstrO0ng_#11"
25+
"db_name" = "mytfdb"
26+
}
27+
db_version = "12.1.0.2"
28+
display_name = "my-dev-db"
29+
}
30+
disk_redundancy = "HIGH"
31+
shape = "BM.DenseIO1.36"
32+
subnet_id = "ocid1.subnet.oc1.phx.aaaaaaaay6exxocfkho64s56qk6q2xrhshajbwursc635v2b7oxnz5i7udjq"
33+
ssh_public_keys = ["somesshkey"]
34+
display_name = "display_name"
35+
domain = "mycompany.com"
36+
hostname = "my-dev-db"
37+
}

0 commit comments

Comments
 (0)