Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aksk authentication support #33

Merged
merged 5 commits into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,31 @@ $ terraform apply # Should all work if everything is correct.

## Quick Start

1. AK/SK Configuration

```hcl
# Configure the HuaweiCloud Provider with AK/SK
# This will work with a single defined/default network, otherwise you need to specify network
# to fix errrors about multiple networks found.
provider "huaweicloud" {
auth_url = "https://iam.cn-north-1.myhwclouds.com/v3"
region = "cn-north-1"
access_key = "access key"
secret_key = "secret key"
}

# Create a web server
resource "huaweicloud_compute_instance_v2" "test-server" {
name = "test-server"
image_name = "Standard_CentOS_7_latest"
flavor_name = "s1.medium"
}
```

2. Username/password Configuration

```hcl
# Configure the HuaweiCloud Provider
# Configure the HuaweiCloud Provider with Username/Password
# This will work with a single defined/default network, otherwise you need to specify network
# to fix errrors about multiple networks found.
provider "huaweicloud" {
Expand Down
14 changes: 7 additions & 7 deletions huaweicloud/compute_instance_v2_networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import (
"log"
"os"

"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/tenantnetworks"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/openstack/networking/v2/ports"
"github.com/hashicorp/terraform/helper/schema"
"github.com/huaweicloud/golangsdk"
"github.com/huaweicloud/golangsdk/openstack/compute/v2/extensions/tenantnetworks"
"github.com/huaweicloud/golangsdk/openstack/compute/v2/servers"
"github.com/huaweicloud/golangsdk/openstack/networking/v2/networks"
"github.com/huaweicloud/golangsdk/openstack/networking/v2/ports"
)

// InstanceNIC is a structured representation of a Gophercloud servers.Server
Expand Down Expand Up @@ -180,7 +180,7 @@ func getInstanceNetworkInfo(
// getInstanceNetworkInfoNovaNet will query the os-tenant-networks API for
// the network information.
func getInstanceNetworkInfoNovaNet(
client *gophercloud.ServiceClient, queryType, queryTerm string) (map[string]interface{}, error) {
client *golangsdk.ServiceClient, queryType, queryTerm string) (map[string]interface{}, error) {

// If somehow a port ended up here, we should just error out.
if queryType == "port" {
Expand Down Expand Up @@ -233,7 +233,7 @@ func getInstanceNetworkInfoNovaNet(
// getInstanceNetworkInfoNeutron will query the neutron API for the network
// information.
func getInstanceNetworkInfoNeutron(
client *gophercloud.ServiceClient, queryType, queryTerm string) (map[string]interface{}, error) {
client *golangsdk.ServiceClient, queryType, queryTerm string) (map[string]interface{}, error) {

// If a port was specified, use it to look up the network ID
// and then query the network as if a network ID was originally used.
Expand Down
Loading