terraform-provider-qiniu

command module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2019 License: MPL-2.0 Imports: 2 Imported by: 0

README

Terraform Provider for Qiniu Cloud

==================

Qiniu Cloud

Requirements

  • Terraform 0.12.x
  • Go 1.12 (to build the provider plugin)

Building The Provider

Clone repository

$ git clone git@github.com:qiniu/terraform-provider-qiniu.git --recurse-submodules

Enter the provider directory and build the provider

$ cd terraform-provider-qiniu
$ make

Install the provider

mkdir -p ~/.terraform.d/plugins
mv bin/terraform-provider-qiniu ~/.terraform.d/plugins

Using the Provider

# Configure Qiniu Account
provider "qiniu" {
  access_key = "<Qiniu Access Key>"
  secret_key = "<Qiniu Secret Key>"
}

# Create Qiniu Bucket
resource "qiniu_bucket" "basic_bucket" {
  name      = "basic-test-terraform-1"  # Bucket Name
  region_id = "z0"                      # Bucket Region, "z0" means East China
  private   = false                     # Public bucket
}

# Create Qiniu Object
resource "qiniu_bucket_object" "basic_object" {
  bucket    = "basic-test-terraform-1"  # Bucket Name
  key       = "qiniu-key"               # File Key
  source    = "/path/to/file"           # File Path to upload
}

# Qiniu Buckets Data Source
data "qiniu_buckets" "z1" {
  name_regex = "^bucket-"
  region_id = "z1"
}

# Qiniu Buckets Objects Data Source
data "qiniu_buckets_objects" "all" {
  bucket = "basic-test-terraform-1"
}

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.12+ is required).

To compile the provider, run make. This will build the provider and put the provider binary in the bin/ directory.

$ make
...
$ bin/terraform-provider-qiniu
...

In order to test the provider, you can copy .env.example to .env, and edit the .env file

QINIU_ACCESS_KEY=<Qiniu Access Key>
QINIU_SECRET_KEY=<Qiniu Secret Key>
TF_ACC=1

And then simply run

make test

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL