Installation Guide
Terraform will create/read/update/delete resource on JDCloud for you automatically. Following guides
show you how to install Terraform together with JDCloud plugin. Commands are given under Ubuntu
Build from binary
Download the Terraform binary, make sure Terraform binary is available in your PATH
.
Download JDCloud plugin into the same directory as Terraform. Detailed instruction can be found in release page
Build from source code (Recommended for developers)
Clone this repository
$ mkdir -p $GOPATH/src/github.com/terraform-providers
$ cd $GOPATH/src/github.com/terraform-providers
$ git clone git@github.com:jdclouddevelopers/terraform-provider-jdcloud
Enter the provider directory and build the provider
$ cd $GOPATH/src/github.com/jdclouddevelopers/terraform-provider-jdcloud
$ make build
Tutorial
Provide access key and secret key
JDCloud resources were managed through a configuration file namely "jdcloud.tf", placed in the same directory as Terraform.
This tutorial gives you an idea on how to edit this configuration file and how this plugin works.
Before everything starts you have to provide access key and secret key.
provider "jdcloud" {
access_key = "EXAMPLEACCESSKEY"
secret_key = "EXAMPLESECRETKEY"
region = "cn-north-1"
}
VPC resource can be created by specifying the name of this VPC resource and the CIDR block. Meanwhile description on this resource is optional. Edit jdcloud.tf
and then execute terraform apply
. Resource on the cloud will be modified consequently.
resource "jdcloud_vpc" "vpc-1" {
vpc_name = "my-vpc-1"
cidr_block = "172.16.0.0/20"
description = "example"
}
Just like creating them through console on web page. You can modify some attributes of resource after it has been created. Execute terraform applyafter it has been modified
resource "jdcloud_vpc" "vpc-1" {
vpc_name = "my-vpc-1"
cidr_block = "172.16.0.0/20"
description = "new and modified description"
}
More
More example on how to create a resource can be found here.
Restrictions on creating/updating a resource can be found here.
Terraform official web page can be found here.
Contact us JDCloud-Team devops@jd.com
License
Mozilla Public License 2.0
Finished Resource:
Terraform-JDCloud plugin is currently under developing, available resources are listed
below. Leave your feedback and advices for this plugin. Advices are very welcomed.
- Instance
- keyPairs
- Disk
- EIP
- Network Interface
- Security Group
- RDS Cloud Database
- Route Table
- Subnet
- VPC