GithubHelp home page GithubHelp logo

alibaba / terraform-provider Goto Github PK

View Code? Open in Web Editor NEW
385.0 51.0 125.0 54.2 MB

[DEPRECATED] This repo has been deprecated and please access https://github.com/terraform-providers/terraform-provider-alicloud

License: Apache License 2.0

Makefile 0.08% HCL 0.04% Go 98.00% Shell 0.06% HTML 1.82%

terraform-provider's Introduction

[NOTES]: This repo has been deprecated and please refer to the latest repo: https://github.com/aliyun/terraform-provider-alicloud

Alicloud (Alibaba Cloud) Terraform provider

This is the official repository of the Alicloud Terraform provider. It currently supports Terraform version ≥ v0.8.2.

If you are not planning to contribute to this repo, you can download the compiled binaries from https://github.com/alibaba/terraform-provider/releases and move the binaries (bin/terraform-provider-alicloud) into the folder under the Terraform PATH such as /usr/local/terraform.

Alternatively, the provider can be installed as described in the developer notes.
This way you will be able to sync the repo as active development is going on.

-> Note: When you use Terraform on a Windows computer, please install golang first, otherwise you might get this issue (the bug appeared in the version 1.8.1 and was fixed in the version 1.11.0).

Example

Example modules can be found in the terraform/examples directory.

Developer notes

Setting up

mkdir -p $GOPATH/src/github.com/alibaba
cd $GOPATH/src/github.com/alibaba
git clone https://github.com/alibaba/terraform-provider.git

# switch to project
cd $GOPATH/src/github.com/alibaba/terraform-provider

# build provider

## Mac
make dev
## Linux
make devlinux
## Windows
make devwin

# install modules
terraform get

# set the creds
export ALICLOUD_ACCESS_KEY="***"
export ALICLOUD_SECRET_KEY="***"
export ALICLOUD_REGION="***"
export ALICLOUD_ACCOUNT_ID="***"

# you're good to start rocking
# alicloud.tf contains the default example
terraform plan
# terraform apply
# terraform destroy

Regions

cn-qingdao
cn-beijing
cn-zhangjiakou
cn-huhehaote
cn-hangzhou
cn-shanghai
cn-shenzhen
cn-hongkong

ap-northeast-1
ap-southeast-1
ap-southeast-2
ap-southeast-3
ap-southeast-5
ap-south-1

us-east-1
us-west-1

me-east-1

eu-central-1

For more information about the regions and availability zones, please use the data sources alicloud_regions and alicloud_zones.

Supported products

Documents

The most recent documentation is available here:

Acceptance Testing

Before making a release, the resources and data sources are tested automatically with acceptance tests (the tests are located in the alicloud/*_test.go files). You can run them by entering the following instructions in a terminal:

cd $GOPATH/src/github.com/alibaba/terraform-provider
export ALICLOUD_ACCESS_KEY=xxx
export ALICLOUD_SECRET_KEY=xxx
export ALICLOUD_REGION=xxx
export ALICLOUD_ACCOUNT_ID=xxx
export outfile=gotest.out
TF_ACC=1 TF_LOG=INFO go test ./alicloud -v -run=TestAccAlicloud -timeout=1440m | tee $outfile
go2xunit -input $outfile -output $GOPATH/tests.xml

-> Note: The last line is optional, it allows to convert test results into a XML format compatible with xUnit.

Because some features are not available in all regions, the following environment variables can be set in order to skip tests that use these features:

  • ALICLOUD_SKIP_TESTS_FOR_SLB_SPECIFICATION=true - Server Load Balancer with guaranteed performance specifications (old implementation has only shared performance)
  • ALICLOUD_SKIP_TESTS_FOR_SLB_PAY_BY_BANDWIDTH=true - Server Load Balancer with a "pay by bandwidth" billing method (mostly available in China)
  • ALICLOUD_SKIP_TESTS_FOR_FUNCTION_COMPUTE=true - Function Compute
  • ALICLOUD_SKIP_TESTS_FOR_PVTZ_ZONE=true - Private Zone
  • ALICLOUD_SKIP_TESTS_FOR_RDS_MULTIAZ=true - Apsara RDS with multiple availability zones
  • ALICLOUD_SKIP_TESTS_FOR_CLASSIC_NETWORK=true - Classic network configuration

Common problems

Error configuring: 1 error(s) occurred:
* Incompatible API version with plugin. Plugin version: 2, Ours: 1

# fix by manually setting the branch in the sources
cd src/github.com/hashicorp/terraform/
git checkout v<YOUR_TF_VERSION_HERE>
cd -

# rebuild
sudo -E "PATH=$PATH" make all

How to contribute

  • If you are not sure or have any doubt, feel free to ask and/or submit an issue or PR. We appreciate all contributions and try to make the process as smooth as possible.
  • Contributions are welcome and will be merged via PRs.

Contributors

License

  • This project is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Reference

terraform-provider's People

Contributors

arafato avatar demonwy avatar heww avatar kuien avatar marcplouhinec avatar mosuke5 avatar otarabai avatar paolomainardi avatar shuwei-yin avatar super468 avatar talentning avatar timorunge avatar vasi-grigo avatar wangyuelucky avatar wgliang avatar xiaozhu36 avatar zhaojie-xu avatar zhuzhih2017 avatar zzxwill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-provider's Issues

Errors when attach multiple disks at the same time

I have a terraform files as below

resource "alicloud_instance" "workers" {
  count = "${var.servers}"
  availability_zone = "${var.zone}"
  image_id = "${var.image_id}"
  instance_name = "${var.instance_name}${count.index}"
  instance_type = "${var.instance_type}"
  io_optimized = "optimized"
  system_disk_category = "cloud_efficiency"
  security_groups = ["${alicloud_security_group.sg-worker.id}"]
  vswitch_id = "${alicloud_vswitch.vsw-worker.id}"

  tags {
    name = "${var.instance_name}-${count.index}"
  }
}

resource "alicloud_disk" "disks" {
  count = "${var.disks_per_server * var.servers}"
  availability_zone = "${var.zone}"
  category          = "cloud_ssd"
  size              = "50"
}

resource "alicloud_disk_attachment" "worker-disk-attach" {
  count = "${var.disks_per_server * var.servers}"
  disk_id     = "${element(alicloud_disk.disks.*.id, count.index)}"
  instance_id = "${element(alicloud_instance.workers.*.id, count.index / var.servers)}"
  device_name = "${var.dev_name[count.index / var.servers]}"
}

What I want to do is to loop through servers and disks and attach ${var.disks_per_server} disks to each server (for ${var.servers} servers).

When I perform terraform apply, I see following output displayed in the console, which appears to be right

I choose 1 worker and 2 disks / worker

module.worker.alicloud_disk_attachment.worker-disk-attach.1: Creating...
  device_name: "" => "/dev/xvdc"
  disk_id:     "" => "d-6wee3ty1dus322d8jm1p"
  instance_id: "" => "i-6weafqgu4s7yap4m2jm2"
module.worker.alicloud_disk_attachment.worker-disk-attach.0: Creating...
  device_name: "" => "/dev/xvdb"
  disk_id:     "" => "d-6weeu3t86gkz0c5rmf5o"
  instance_id: "" => "i-6weafqgu4s7yap4m2jm2"
module.worker.alicloud_disk_attachment.worker-disk-attach.0: Still creating... (10s elapsed)
module.worker.alicloud_disk_attachment.worker-disk-attach.0: Creation complete (ID: d-6weeu3t86gkz0c5rmf5o:i-6weafqgu4s7yap4m2jm2)

2 disk id ["d-6wee3ty1dus322d8jm1p", "d-6weeu3t86gkz0c5rmf5o"] attached to the same "i-6weafqgu4s7yap4m2jm2" instance id.

however, I see the following error:

Error applying plan:

1 error(s) occurred:

* module.worker.alicloud_disk_attachment.worker-disk-attach[1]: 1 error(s) occurred:

* alicloud_disk_attachment.worker-disk-attach.1: Aliyun API Error: RequestId: 9944E85F-98A2-4582-A28F-0F29C9470B7F Status Code: 409 Code: OperationConflict Message: Request was denied due to conflict with a previous request.

Is it a bug?

The specified RegionId does not support the creation of the network type ECS instance

I tried using the examples/alicloud-ecs and received the following error. I am running terraform from an aliyun instance in Hangzhou (not international). Help is appreciated - I am new to terraform and aliyun.

[root@demo001 alicloud-ecs]# cp ~/alicloud.tf .
[root@demo001 alicloud-ecs]# terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.alicloud_instance_types.instance_type: Refreshing state...
The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed. Cyan entries are data sources to be read.

Note: You didn't specify an "-out" parameter to save this plan, so when
"apply" is called, Terraform can't guarantee this is what will execute.

  • alicloud_disk.disk
    availability_zone: "${alicloud_instance.instance.0.availability_zone}"
    category: "cloud_efficiency"
    size: "40"
    status: ""

  • alicloud_disk_attachment.instance-attachment
    device_name: "/dev/xvdb"
    disk_id: "${element(alicloud_disk.disk..id, count.index)}"
    instance_id: "${element(alicloud_instance.instance.
    .id, count.index)}"

  • alicloud_instance.instance
    allocate_public_ip: "true"
    availability_zone: ""
    host_name: "hi-work-01"
    image_id: "ubuntu_140405_64_40G_cloudinit_20161115.vhd"
    instance_charge_type: "PostPaid"
    instance_name: "hi-work-01"
    instance_type: "ecs.n1.small"
    internet_charge_type: "PayByTraffic"
    internet_max_bandwidth_out: "5"
    io_optimized: "optimized"
    password: ""
    private_ip: ""
    public_ip: ""
    security_groups.#: ""
    status: ""
    subnet_id: ""
    system_disk_category: "cloud_efficiency"
    system_disk_size: ""
    tags.%: "2"
    tags.dc: "beijing"
    tags.role: "work"

  • alicloud_security_group.group
    description: "New security group"
    name: "hi"

  • alicloud_security_group_rule.allow_http_80
    cidr_ip: "0.0.0.0/0"
    ip_protocol: "tcp"
    nic_type: "internet"
    policy: "accept"
    port_range: "80/80"
    priority: "1"
    security_group_id: "${alicloud_security_group.group.id}"
    type: "ingress"

  • alicloud_security_group_rule.allow_https_443
    cidr_ip: "0.0.0.0/0"
    ip_protocol: "tcp"
    nic_type: "internet"
    policy: "accept"
    port_range: "443/443"
    priority: "1"
    security_group_id: "${alicloud_security_group.group.id}"
    type: "ingress"

Plan: 6 to add, 0 to change, 0 to destroy.
[root@demo001 alicloud-ecs]# terraform apply
data.alicloud_instance_types.instance_type: Refreshing state...
alicloud_security_group.group: Creating...
description: "" => "New security group"
name: "" => "hi"
alicloud_security_group.group: Creation complete (ID: sg-2ze2ol...kq8ffwyv)
alicloud_security_group_rule.allow_https_443: Creating...
cidr_ip: "" => "0.0.0.0/0"
ip_protocol: "" => "tcp"
nic_type: "" => "internet"
policy: "" => "accept"
port_range: "" => "443/443"
priority: "" => "1"
security_group_id: "" => "sg-2ze2ol6d0s1rkq8ffwyv"
type: "" => "ingress"
alicloud_security_group_rule.allow_http_80: Creating...
cidr_ip: "" => "0.0.0.0/0"
ip_protocol: "" => "tcp"
nic_type: "" => "internet"
policy: "" => "accept"
port_range: "" => "80/80"
priority: "" => "1"
security_group_id: "" => "sg-2ze2ol6d0s1rkq8ffwyv"
type: "" => "ingress"
alicloud_instance.instance: Creating...
allocate_public_ip: "" => "true"
availability_zone: "" => ""
host_name: "" => "hi-work-01"
image_id: "" => "ubuntu_140405_64_40G_cloudinit_20161115.vhd"
instance_charge_type: "" => "PostPaid"
instance_name: "" => "hi-work-01"
instance_type: "" => "ecs.n1.small"
internet_charge_type: "" => "PayByTraffic"
internet_max_bandwidth_out: "" => "5"
io_optimized: "" => "optimized"
password: "" => ""
private_ip: "" => ""
public_ip: "" => ""
security_groups.#: "" => "1"
security_groups.1133593612: "" => "sg-2ze2ol6d0s1rkq8ffwyv"
status: "" => ""
subnet_id: "" => ""
system_disk_category: "" => "cloud_efficiency"
system_disk_size: "" => ""
tags.%: "" => "2"
tags.dc: "" => "beijing"
tags.role: "" => "work"
alicloud_security_group_rule.allow_https_443: Creation complete (ID: sg-2ze2ol...internet)
alicloud_security_group_rule.allow_http_80: Creation complete (ID: sg-2ze2ol...internet)
Error applying plan:

1 error(s) occurred:

  • alicloud_instance.instance: 1 error(s) occurred:

  • alicloud_instance.instance: Error creating Aliyun ecs instance: &common.Error{ErrorResponse:common.ErrorResponse{Response:common.Response{RequestId:"8754CD9E-4074-4168-9052-544A99EA7E1E"}, HostId:"ecs-cn-hangzhou.aliyuncs.com", Code:"OperationDenied", Message:"The specified RegionId does not support the creation of the network type ECS instance."}, StatusCode:403}

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

NAT Gateway usage example

Hello alibaba team,

I'm not sure if I'm asking in the right place, but it would be very nice if you could explain how exactly I should use NAT gateway via terraform.

Now I'm using it like this:

resource "alicloud_nat_gateway" "main" {
  vpc_id = "${alicloud_vpc.main.id}"
  spec = "Small"
  bandwidth_packages = [
    {
      ip_count = 1
      bandwidth = 5
      zone = "${var.availability_zone}"
    }
  ]
  depends_on = [
    "alicloud_vswitch.main"]
}

As expected, vrouter for vpc was modified with default route of nat gateway but it's not seems to work.
Am I missing something? I could not find any documentation of nat gateways either in aliyun console or api reference.

Thanks,
Alex

Aliyun provider could not query zones in Japan region

Hi, I noticed that the provider could not query zone in Japan region

» cat alicloud.tfvars
access_key = "***"
secret_key = "***"
region = "ap-northeast-1"

» terraform apply -var-file="alicloud.tfvars"
alicloud_instance.web: Creating...
  allocate_public_ip:    "" => "false"
  availability_zone:     "" => "ap-northeast-1a"
  host_name:             "" => "<computed>"
  image_id:              "" => "centos_5u11_32_40G_cloudinit_20161115.vhd"
  instance_name:         "" => "web-terraform"
  instance_network_type: "" => "<computed>"
  instance_type:         "" => "ecs.n1.tiny"
  internet_charge_type:  "" => "PayByTraffic"
  io_optimized:          "" => "optimized"
  private_ip:            "" => "<computed>"
  public_ip:             "" => "<computed>"
  status:                "" => "<computed>"
  subnet_id:             "" => "<computed>"
  system_disk_category:  "" => "cloud_efficiency"
  system_disk_size:      "" => "<computed>"
Error applying plan:

1 error(s) occurred:

* alicloud_instance.web: error to list zones not found

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

I can get zoneId using aliyuncli as following

» aliyuncli ecs DescribeZones --RegionId ap-northeast-1
...
"ZoneId": "ap-northeast-1a",
                "AvailableInstanceTypes": {
                    "InstanceTypes": [
                        "ecs.e4.small",
                        "ecs.e4.large",
                        "ecs.n4.4xlarge",
...

alicloud_nat_gateway port forwarding

Does terraform support alicloud_nat_gateway with port forwarding definition? I tried searching the documentation but it appears this may be an enhancement request?

Something like this would be very helpful:
resource "alicloud_nat_gateway_port_forwarding" "edge-all-forward" {
external_eip_id = ...
internal_ip or instance_id (required) = ...
exteranal_ports = -1/-1
internal_ports = -1/-1
protocal_type = tcp/udp/any
}

Alicloud plugin cause Terraform crash

Crash log as following:

terraform refresh
alicloud_vpc.mycompany_dev_vpc: Refreshing state... (ID: vpc-2zexc...9edmqyt6)
alicloud_security_group.dev-depta-backend: Refreshing state... (ID: sg-2ze0jl...z5xcx8oa)
alicloud_security_group.dev-depta-database: Refreshing state... (ID: sg-2zehfs...f90ixx29)
alicloud_security_group_rule.depta-backend-to-database_mysql: Refreshing state... (ID: sg-2zehfs...intranet)
Error refreshing state: 1 error(s) occurred:

* alicloud_security_group_rule.depta-backend-to-database_mysql: alicloud_security_group_rule.depta-backend-to-database_mysql: unexpected EOF
panic: runtime error: invalid memory address or nil pointer dereference
2017/03/29 19:30:27 [DEBUG] plugin: terraform: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x16f8399]
2017/03/29 19:30:27 [DEBUG] plugin: terraform:
2017/03/29 19:30:27 [DEBUG] plugin: terraform: goroutine 40 [running]:
2017/03/29 19:30:27 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/builtin/providers/alicloud.resourceAliyunSecurityGroupRuleRead(0xc4203035e0, 0x57f2600, 0xc420533d80, 0x0, 0x8108380)
2017/03/29 19:30:27 [DEBUG] plugin: terraform: 	/opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/alicloud/resource_alicloud_security_group_rule.go:145 +0x529
2017/03/29 19:30:27 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(*Resource).Refresh(0xc42029dd40, 0xc4208460f0, 0x57f2600, 0xc420533d80, 0xc4203aebe0, 0xc420986901, 0xc420047a88)
2017/03/29 19:30:27 [DEBUG] plugin: terraform: 	/opt/gopath/src/github.com/hashicorp/terraform/helper/schema/resource.go:314 +0x21d
2017/03/29 19:30:27 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(*Provider).Refresh(0xc420303500, 0xc4208460a0, 0xc4208460f0, 0x93bb960, 0x0, 0xc420886230)
2017/03/29 19:30:27 [DEBUG] plugin: terraform: 	/opt/gopath/src/github.com/hashicorp/terraform/helper/schema/provider.go:267 +0x91
2017/03/29 19:30:27 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Refresh(0xc4201be960, 0xc4201c6130, 0xc4201c63a0, 0x0, 0x0)
2017/03/29 19:30:27 [DEBUG] plugin: terraform: 	/opt/gopath/src/github.com/hashicorp/terraform/plugin/resource_provider.go:510 +0x4e
2017/03/29 19:30:27 [DEBUG] plugin: terraform: reflect.Value.call(0xc42032ce40, 0xc42017c040, 0x13, 0x58ac3de, 0x4, 0xc420047f20, 0x3, 0x3, 0x0, 0xc420a98930, ...)
2017/03/29 19:30:27 [DEBUG] plugin: terraform: 	/opt/go/src/reflect/value.go:434 +0x91f
2017/03/29 19:30:27 [DEBUG] plugin: terraform: reflect.Value.Call(0xc42032ce40, 0xc42017c040, 0x13, 0xc42065c720, 0x3, 0x3, 0xc420467c80, 0x11fea73, 0xc420a50700)
2017/03/29 19:30:27 [DEBUG] plugin: terraform: 	/opt/go/src/reflect/value.go:302 +0xa4
2017/03/29 19:30:27 [DEBUG] plugin: terraform: net/rpc.(*service).call(0xc4204fa080, 0xc4204fa040, 0xc42049e2a0, 0xc420291500, 0xc4208f4220, 0x4b2f480, 0xc4201c6130, 0x16, 0x4b2f4c0, 0xc4201c63a0, ...)
2017/03/29 19:30:27 [DEBUG] plugin: terraform: 	/opt/go/src/net/rpc/server.go:387 +0x144
2017/03/29 19:30:27 [DEBUG] plugin: terraform: created by net/rpc.(*Server).ServeCodec
2017/03/29 19:30:27 [DEBUG] plugin: terraform: 	/opt/go/src/net/rpc/server.go:481 +0x404
2017/03/29 19:30:27 [ERROR] root: eval: *terraform.EvalRefresh, err: alicloud_security_group_rule.depta-backend-to-database_mysql: unexpected EOF
2017/03/29 19:30:27 [ERROR] root: eval: *terraform.EvalSequence, err: alicloud_security_group_rule.depta-backend-to-database_mysql: unexpected EOF
2017/03/29 19:30:27 [TRACE] [walkRefresh] Exiting eval tree: alicloud_security_group_rule.depta-backend-to-database_mysql
2017/03/29 19:30:27 [DEBUG] plugin: /usr/local/Cellar/terraform/0.9.1_1/bin/terraform: plugin process exited
2017/03/29 19:30:27 [DEBUG] plugin: waiting for all plugin processes to complete...
2017/03/29 19:30:27 [WARN] plugin: error closing client during Kill: connection is shut down



!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Reproduce steps as below:

  1. Create a new tf file and apply it
resource "alicloud_vpc" "mycompany_dev_vpc" {
  name = "MY-DEV"
  cidr_block = "10.200.0.0/16"
}

resource "alicloud_security_group" "dev-depta-backend" {
    name = "dev-depta-backend"
    description = "DEV-DEPTA-BACKEND"
    vpc_id = "${alicloud_vpc.mycompany_dev_vpc.id}"
}
resource "alicloud_security_group" "dev-depta-database" {
    name = "dev-depta-database"
    description = "DEV-DEPTA-DATABASE"
    vpc_id = "${alicloud_vpc.mycompany_dev_vpc.id}"
}

resource "alicloud_security_group_rule" "depta-backend-to-database_mysql" {
  type = "ingress"
  ip_protocol = "tcp"
  nic_type = "intranet"
  policy = "accept"
  port_range = "3306/3306"
  priority = 50
  # description = "hahahahaha"
  security_group_id = "${alicloud_security_group.dev-depta-database.id}"
  source_security_group_id = "${alicloud_security_group.dev-depta-backend.id}"
}

  1. Go to Aliyun web console, delete rule "depta-backend-to-database_mysql"
  2. Run terraform refresh or terraform apply again and terraform crashs.

ECS module not recognizing region

Hello,

I'm using the alicloud-ecs-vpc module and it seems that even if I set my region, the module still points to "https://ecs-cn-hangzhou.aliyuncs.com"

 alicloud_security_group_rule.allow_all_udp: Error SecurityGroup rule: &common.Error{ErrorResponse:common.ErrorResponse{Response:common.Response{RequestId:""}, HostId:"", Code:"AliyunGoClientFailure", Message:"Get https://ecs-cn-hangzhou.aliyuncs.com?AccessKeyId=

I omitted some of the error.

Terraform plan not getting some attributes after instance creation

Hello Alibaba team,

Upon calling "terraform plan", attributes "internet_charge_type" and "internet_max_bandwidth_out" are always empty, which forces instance to be recreated.

For example:

main.tf:

resource "alicloud_instance" "instance" {
...
  internet_charge_type = "PayByTraffic"
  internet_max_bandwidth_out = "5"
...
} 

when running terraform:

  internet_charge_type:       "" => "PayByTraffic"
  internet_max_bandwidth_out: "" => "5"

Terraform plan output when created:

-/+ module.demo-instance.alicloud_instance.instance
...
    internet_charge_type:       "" => "PayByTraffic" (forces new resource)
    internet_max_bandwidth_out: "" => "5" (forces new resource)
...

Sometimes terraform is able to get "internet_max_bandwidth_out", but never "internet_charge_type".
Please fix this.

Thanks,
Alex

I just change zone from beijing to shanghai in alicloud-ecs-vpc, but it doesn't work

opsforce-Mac:alicloud-ecs-vpc opsforce$ terraform apply
var.ecs_type
Enter a value: ecs.n1.tiny

alicloud_disk.disk: Creating...
availability_zone: "" => "cn-shanghai-a"
category: "" => "cloud_ssd"
size: "" => "40"
status: "" => ""
alicloud_instance.instance: Creating...
allocate_public_ip: "" => "false"
availability_zone: "" => "cn-shanghai-a"
host_name: "" => "mfg-cloud-01"
image_id: "" => "m-uf64gabqbdpj51otskfc"
instance_charge_type: "" => "PostPaid"
instance_name: "" => "mfg-cloud-01"
instance_type: "" => "ecs.n1.tiny"
internet_charge_type: "" => "PayByTraffic"
internet_max_bandwidth_out: "" => "1"
io_optimized: "" => "optimized"
password: "" => ""
private_ip: "" => ""
public_ip: "" => ""
security_groups.#: "" => "1"
security_groups.3433535800: "" => "sg-uf63o7ulmhwcxq3d22yc"
status: "" => ""
subnet_id: "" => ""
system_disk_category: "" => "cloud_efficiency"
system_disk_size: "" => ""
tags.%: "" => "2"
tags.dc: "" => "shanghai"
tags.role: "" => "cloud"
vswitch_id: "" => "vsw-uf6ikmcb6dxiepi9t0b2h"
Error applying plan:

2 error(s) occurred:

  • alicloud_disk.disk: 1 error(s) occurred:

  • alicloud_disk.disk: availability_zone not exists in range cn-beijing, all zones are [cn-beijing-d cn-beijing-a cn-beijing-b cn-beijing-c]

  • alicloud_instance.instance: 1 error(s) occurred:

  • alicloud_instance.instance: availability_zone not exists in range cn-beijing, all zones are [cn-beijing-d cn-beijing-a cn-beijing-b cn-beijing-c]

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Not able to import existing resource

 % terraform import alicloud_db_instance.test 'rm-j6cymcqykvo948205'
alicloud_db_instance.test: Importing from ID "rm-j6cymcqykvo948205"...
Error importing: 1 error(s) occurred:

* alicloud_db_instance.test (import id: rm-j6cymcqykvo948205): import alicloud_db_instance.test (id: rm-j6cymcqykvo948205): resource alicloud_db_instance doesn't support import

Will "import" be supported in the future version of alicloud provider ?

Error when use new version of plugin

➜ /Users/myvpc > terraform version
[WARN] /usr/local/Cellar/terraform/0.9.1_1/bin/terraform-provider-alicloud overrides an internal plugin for alicloud-provider.
  If you did not expect to see this message you will need to remove the old plugin.
  See https://www.terraform.io/docs/internals/internal-plugins.html
Terraform v0.9.2

➜ /Users/myvpc > terraform apply
[WARN] /usr/local/Cellar/terraform/0.9.1_1/bin/terraform-provider-alicloud overrides an internal plugin for alicloud-provider.
  If you did not expect to see this message you will need to remove the old plugin.
  See https://www.terraform.io/docs/internals/internal-plugins.html
Error asking for user input: 1 error(s) occurred:

* provider.alicloud: Incompatible API version with plugin. Plugin version: 2, Ours: 4

Any idea what cause this?

Unable to build from source

Hello Alibaba team,

I'm getting an error when trying to build from source:

$ go get ./...
# github.com/alibaba/terraform-provider/alicloud
alicloud/resource_alicloud_slb.go:147: cannot use common.InternetChargeType(v.(string)) (type common.InternetChargeType) as type slb.InternetChargeType in assignment

OS: Ubuntu 16.04.1 LTS
Golang: go1.7.4 linux/amd64

Steps to reproduce (via guide from README.md):

1) cd $GOPATH
2) mkdir -p src/github.com/alibaba
3) git clone https://github.com/alibaba/terraform-provider.git
4) mv terraform-provider src/github.com/alibaba
5) cd src/github.com/alibaba/terraform-alicloud
6) go get ./...

Also, If possible please provide binary for ubuntu x64, because I cannot use binary from http://opensource-tf.oss-cn-shanghai.aliyuncs.com/terraform-provider-alicloud - it's compiled for osx.

By the way, thanks for your efforts to make aliyun accessible with modern tools such as terraform.

Regards,
Alex

chaging imgage_id can not work

after changing the image_id and security_groups attribute in alicloud_instance block, here is the logs of terraform plan and terraform apply.

logs of terraform plan:

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

~ alicloud_instance.example
image_id: "xxxx" => "yyyy"
security_groups.3716797384: "" => "sg-yyyy"
security_groups.3812892935: "sg-xxxx" => ""

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

logs of terraform apply:

===========================
alicloud_instance.example: Refreshing state... (ID: i-bp1hgp7jllqsxxbylsgs)
alicloud_instance.example: Modifying... (ID: i-bp1hgp7jllqsxxbylsgs)
image_id: "xxxx" => "yyyy"
security_groups.3716797384: "" => "yyyy"
security_groups.3812892935: "sg-xxxx" => ""
alicloud_instance.example: Still modifying... (ID: i-bp1hgp7jllqsxxbylsgs, 10s elapsed)
alicloud_instance.example: Still modifying... (ID: i-bp1hgp7jllqsxxbylsgs, 20s elapsed)
alicloud_instance.example: Still modifying... (ID: i-bp1hgp7jllqsxxbylsgs, 30s elapsed)
alicloud_instance.example: Still modifying... (ID: i-bp1hgp7jllqsxxbylsgs, 40s elapsed)
alicloud_instance.example: Modifications complete (ID: i-bp1hgp7jllqsxxbylsgs)

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

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

from the logs above, the changes should be applied, but what we confirmed on the ecs console page is diffenrent: the security group has been changed but not the image_id.

by the way, with the command terraform show we can also confirmed that the image_id not be changed.

Security groups configuration support

Hello Alibaba team,

I'm trying to find any reference in provider that will allow to configure security groups access rules.
As far as I understand, currently there is no support for API that mention in https://intl.aliyun.com/help/doc-detail/25554.htm

Is this true? If so, can you please suggest in what terms you are planning to implement this support?
I find this unfortunate because all other features seems to present.

Thanks,
Alex

Support for Container Service

Is there any plan to support container service resources to this provider ?

The creation of clusters involves multiple moving parts and being able to quickly provision a new cluster with vpc, nat, etc, would be really convenient.

OSS as a terraform backend

For users in mainland China, having OSS as a terraform backend would be very nice. I don't know if locking would be possible on OSS but it would be a real plus.

provider.alicloud: unexpected EOF

I have got the error below so many times when run terraform plan:

➜  cn_shanghai_beta git:(master) ✗ tf plan
[WARN] /usr/local/bin/terraform-provider-alicloud overrides an internal plugin for alicloud-provider.
  If you did not expect to see this message you will need to remove the old plugin.
  See https://www.terraform.io/docs/internals/internal-plugins.html
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.template_file.user_data: Refreshing state...
alicloud_security_group.cc: Refreshing state... (ID: sg-uf60v0csy0zj4l4xo62g)
Error refreshing state: 6 error(s) occurred:

* module.sg_web.provider.alicloud: unexpected EOF
* module.vpc.provider.alicloud: unexpected EOF
* module.bastion.provider.alicloud: unexpected EOF
* alicloud_security_group.cc: 1 error(s) occurred:

* alicloud_security_group.cc: alicloud_security_group.cc: unexpected EOF
* module.sg_service.provider.alicloud: unexpected EOF
* module.sg_gitlab_runner.provider.alicloud: unexpected EOF

I have to try 3 or 4 times and then get a successful terraform plan.

And when in the debug mode I got the errors below, I'm not a Golang developer, not sure if the below error message could help or not.

2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud:
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: goroutine 220 [IO wait]:
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net.runtime_pollWait(0x1e81e28, 0x72, 0xc)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/runtime/netpoll.go:164 +0x59
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net.(*pollDesc).wait(0xc420055a38, 0x72, 0x1beb640, 0x1be6570)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/fd_poll_runtime.go:75 +0x38
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net.(*pollDesc).waitRead(0xc420055a38, 0xc4204eb400, 0x400)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/fd_poll_runtime.go:80 +0x34
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net.(*netFD).Read(0xc4200559d0, 0xc4204eb400, 0x400, 0x400, 0x0, 0x1beb640, 0x1be6570)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/fd_unix.go:250 +0x1b7
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net.(*conn).Read(0xc4201b24f8, 0xc4204eb400, 0x400, 0x400, 0x0, 0x0, 0x0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/net.go:181 +0x70
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: crypto/tls.(*block).readFromUntil(0xc420604f30, 0x1e8d1d8, 0xc4201b24f8, 0x5, 0xc4201b24f8, 0xc4202648a0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/crypto/tls/conn.go:488 +0x98
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: crypto/tls.(*Conn).readRecord(0xc420500380, 0x182a817, 0xc4205004a0, 0x1051bc0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/crypto/tls/conn.go:590 +0xc4
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: crypto/tls.(*Conn).Read(0xc420500380, 0xc4207de000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/crypto/tls/conn.go:1134 +0x11d
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net/http.(*persistConn).Read(0xc4201ce6c0, 0xc4207de000, 0x1000, 0x1000, 0x182a8c8, 0x0, 0xc420264b80)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/http/transport.go:1316 +0x14b
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: bufio.(*Reader).fill(0xc420790f60)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/bufio/bufio.go:97 +0x117
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: bufio.(*Reader).Peek(0xc420790f60, 0x1, 0xc4207910e0, 0xc420024480, 0x20, 0x20, 0x1)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/bufio/bufio.go:129 +0x67
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net/http.(*persistConn).readLoop(0xc4201ce6c0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/http/transport.go:1474 +0x196
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: created by net/http.(*Transport).dialConn
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/http/transport.go:1117 +0xa35
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud:
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: goroutine 201 [select]:
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/vendor/github.com/hashicorp/terraform/vendor/github.com/hashicorp/yamux.(*Stream).Read(0xc420748340, 0xc420794000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/vendor/github.com/hashicorp/terraform/vendor/github.com/hashicorp/yamux/stream.go:130 +0x2af
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: bufio.(*Reader).Read(0xc42049ef60, 0xc4205e2f30, 0x1, 0x9, 0xc4205e34b0, 0x194, 0xc4205e3490)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/bufio/bufio.go:213 +0x312
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: io.ReadAtLeast(0x1be7d40, 0xc42049ef60, 0xc4205e2f30, 0x1, 0x9, 0x1, 0x194, 0xc4205e34b0, 0x3)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/io/io.go:307 +0xa9
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: io.ReadFull(0x1be7d40, 0xc42049ef60, 0xc4205e2f30, 0x1, 0x9, 0x1029476, 0x0, 0x4)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/io/io.go:325 +0x58
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: encoding/gob.decodeUintReader(0x1be7d40, 0xc42049ef60, 0xc4205e2f30, 0x9, 0x9, 0xc42076da70, 0x1028dae, 0xc400000008, 0xc4203d3980)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/encoding/gob/decode.go:119 +0x63
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: encoding/gob.(*Decoder).recvMessage(0xc420751e00, 0xc42076da80)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/encoding/gob/decoder.go:76 +0x57
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: encoding/gob.(*Decoder).decodeTypeSequence(0xc420751e00, 0x182a800, 0xc420751e00)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/encoding/gob/decoder.go:140 +0x167
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: encoding/gob.(*Decoder).DecodeValue(0xc420751e00, 0x16c0f80, 0xc42075de80, 0x16, 0x0, 0x0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/encoding/gob/decoder.go:208 +0xe8
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: encoding/gob.(*Decoder).Decode(0xc420751e00, 0x16c0f80, 0xc42075de80, 0xc42000e9f0, 0xc4201ab460)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/encoding/gob/decoder.go:185 +0x16d
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net/rpc.(*gobServerCodec).ReadRequestHeader(0xc4205b59e0, 0xc42075de80, 0x17941c0, 0xc4205b5fb0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/rpc/server.go:407 +0x45
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net/rpc.(*Server).readRequestHeader(0xc4201ab440, 0x1bef640, 0xc4205b59e0, 0xc42000e9f0, 0x16, 0xc42075d720, 0x17c2a01, 0x0, 0x0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/rpc/server.go:580 +0x6c
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net/rpc.(*Server).readRequest(0xc4201ab440, 0x1bef640, 0xc4205b59e0, 0xc4201ab440, 0xc4205e2f50, 0xc420751780, 0xc42075d720, 0x179f500, 0xc4205b5fb0, 0x16, ...)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/rpc/server.go:547 +0x5a
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net/rpc.(*Server).ServeCodec(0xc4201ab440, 0x1bef640, 0xc4205b59e0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/rpc/server.go:466 +0x77
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net/rpc.(*Server).ServeConn(0xc4201ab440, 0x2ca0000, 0xc420748340)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/rpc/server.go:458 +0x373
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/vendor/github.com/hashicorp/terraform/vendor/github.com/hashicorp/go-plugin.serve(0x2ca0000, 0xc420748340, 0x17fcb99, 0x6, 0x17bc180, 0xc42075d6a0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/vendor/github.com/hashicorp/terraform/vendor/github.com/hashicorp/go-plugin/rpc_server.go:184 +0x157
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/vendor/github.com/hashicorp/terraform/vendor/github.com/hashicorp/go-plugin.(*dispenseServer).Dispense.func1(0xc42021a120, 0xc400000012, 0xc4205e2bf8, 0x8, 0x17bc180, 0xc42075d6a0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/vendor/github.com/hashicorp/terraform/vendor/github.com/hashicorp/go-plugin/rpc_server.go:171 +0x199
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: created by github.com/alibaba/terraform-provider/vendor/github.com/hashicorp/terraform/vendor/github.com/hashicorp/go-plugin.(*dispenseServer).Dispense
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/vendor/github.com/hashicorp/terraform/vendor/github.com/hashicorp/go-plugin/rpc_server.go:172 +0x1d1
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud:
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: goroutine 184 [runnable]:
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: reflect.(*rtype).Field(0x17cfa60, 0x0, 0x166214f, 0x6, 0x0, 0x0, 0x1bf4a00, 0x16d9a20, 0x0, 0x0, ...)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/reflect/type.go:957 +0x14d
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/vendor/github.com/denverdino/aliyungo/util.setQueryValues(0x17cfa60, 0xc4201e7600, 0xc420761458, 0x0, 0x0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/vendor/github.com/denverdino/aliyungo/util/encoding.go:64 +0x3fe
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/vendor/github.com/denverdino/aliyungo/util.SetQueryValues(0x17cfa60, 0xc4201e7600, 0xc420761458)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/vendor/github.com/denverdino/aliyungo/util/encoding.go:39 +0x51
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/vendor/github.com/denverdino/aliyungo/util.ConvertToQueryValues(0x17cfa60, 0xc4201e7600, 0x17cfa60)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/vendor/github.com/denverdino/aliyungo/util/encoding.go:33 +0x74
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/vendor/github.com/denverdino/aliyungo/common.(*Client).Invoke(0xc4202d0360, 0x1805013, 0xf, 0x16b1440, 0x1c3fa88, 0x16b1480, 0xc420597890, 0x0, 0x0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/vendor/github.com/denverdino/aliyungo/common/client.go:122 +0x136
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/vendor/github.com/denverdino/aliyungo/ecs.(*Client).DescribeRegions(0xc4202d0360, 0x1a, 0x1, 0x1800195, 0x9, 0xc42028d700)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/vendor/github.com/denverdino/aliyungo/ecs/regions.go:28 +0x10f
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/alicloud.(*Config).ecsConn(0xc420761a00, 0x0, 0x0, 0x0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/alicloud/config.go:134 +0x10b
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/alicloud.(*Config).Client(0xc420761a00, 0x17fd6af, 0x6, 0x16d9a20)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/alicloud/config.go:50 +0x64
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/alicloud.providerConfigure(0xc42015cd20, 0xc42015cd20, 0xc420596cc0, 0xc42062eec0, 0x0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/alicloud/provider.go:112 +0x1a8
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Configure(0xc4201b0230, 0xc420596cc0, 0xc42062a080, 0xc42003ab10)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:223 +0xed
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: github.com/alibaba/terraform-provider/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Configure(0xc42075d140, 0xc420596cc0, 0xc420248468, 0x0, 0x0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/Users/heguimin/Projects/go/src/github.com/alibaba/terraform-provider/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:478 +0x42
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: reflect.Value.call(0xc420019620, 0xc4202ba110, 0x13, 0x17fb1c2, 0x4, 0xc42003af20, 0x3, 0x3, 0x0, 0x0, ...)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/reflect/value.go:434 +0x91f
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: reflect.Value.Call(0xc420019620, 0xc4202ba110, 0x13, 0xc42077a720, 0x3, 0x3, 0x0, 0x0, 0x0)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/reflect/value.go:302 +0xa4
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net/rpc.(*service).call(0xc42026a680, 0xc42026a640, 0xc42021aab8, 0xc42026d180, 0xc42062a080, 0x179f500, 0xc420596cc0, 0x16, 0x16b8080, 0xc420248468, ...)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/rpc/server.go:387 +0x144
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: created by net/rpc.(*Server).ServeCodec
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/rpc/server.go:481 +0x404
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud:
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: goroutine 190 [select]:
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net/http.(*persistConn).writeLoop(0xc420754480)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/http/transport.go:1704 +0x43a
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: created by net/http.(*Transport).dialConn
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/http/transport.go:1118 +0xa5a
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud:
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: goroutine 236 [select]:
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: net.(*netFD).connect.func2(0x1bef380, 0xc420707020, 0xc42011ac40, 0xc4207071a0, 0xc420707140)
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/fd_unix.go:133 +0x1d5
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: created by net.(*netFD).connect
2017/08/07 20:13:07 [DEBUG] plugin: terraform-provider-alicloud: 	/usr/local/go/src/net/fd_unix.go:144 +0x239
2017/08/07 20:13:07 [DEBUG] plugin: /usr/local/bin/terraform-provider-alicloud: plugin process exited
2017/08/07 20:13:07 [DEBUG] plugin: /usr/local/bin/terraform: plugin process exited

Error thrown when creating multiple VSwitch(s) at the same time

# VPCの作成
resource "alicloud_vpc" "vpc" {
  name = "mongovpc"
  cidr_block = "10.0.0.0/16"
}

# vswitchの作成。mongo-primary
resource "alicloud_vswitch" "mongo-primary" {
  name              = "mongo-primary"
  vpc_id            = "${alicloud_vpc.vpc.id}"
  cidr_block        = "10.0.0.0/19"
  availability_zone = "${var.zone}"
}

# vswitchの作成。mongo-secondary0
resource "alicloud_vswitch" "mongo-secondary0" {
  name              = "mongo-secondary0"
  vpc_id            = "${alicloud_vpc.vpc.id}"
  cidr_block        = "10.0.32.0/19"
  availability_zone = "${var.zone}"
}

When trying to create multiple vswitchs, I get the following message. I think it should be no problem writing tf file like this.

* alicloud_vswitch.mongo-primary: Create subnet got a error :Aliyun API Error: RequestId: 89BA91FE-886A-49AD-B43F-2FA32604DA49 Status Code: 400 Code: IncorrectVSwitchStatus Message: VSwitch Creation simultaneously is not supported.
* alicloud_vswitch.nat-bastion: 1 error(s) occurred:

* alicloud_vswitch.nat-bastion: Create subnet got a error :Aliyun API Error: RequestId: 6CAF7C47-267F-46F3-8C8B-6007E768E758 Status Code: 400 Code: IncorrectVSwitchStatus Message: VSwitch Creation simultaneously is not supported.

Terraform not correctly setting "nic_type" for security group rule

Hello Alibaba team,

When creating security group role, terraform always sets "nic_type" to "intranet".

For example:
main.tf:

resource "alicloud_security_group_rule" "ssh" {
  type = "ingress"
  ip_protocol = "tcp"
  nic_type = "internet"
  policy = "accept"
  port_range = "22/22"
  priority = "1"
  security_group_id = "${alicloud_security_group.sg.id}"
  cidr_ip = "0.0.0.0/0"
}

Terraform execution:

  cidr_ip:           "" => "0.0.0.0/0"
  ip_protocol:       "" => "tcp"
  nic_type:          "" => "internet"
  policy:            "" => "accept"
  port_range:        "" => "22/22"
  priority:          "" => "1"
  security_group_id: "" => "sg-2ze7hw1sj9szm09q2c4a"
  type:              "" => "ingress"

Terraform plan after creation:

    cidr_ip:           "0.0.0.0/0" => "0.0.0.0/0"
    ip_protocol:       "tcp" => "tcp"
    nic_type:          "intranet" => "internet" (forces new resource)
    policy:            "accept" => "accept"
    port_range:        "22/22" => "22/22"
    priority:          "1" => "1"
    security_group_id: "sg-2ze7hw1sj9szm09q2c4a" => "sg-2ze7hw1sj9szm09q2c4a"
    type:              "ingress" => "ingress"

Also, I was able to confirm this after reviewing new rule in ECS Managment Console: I see new rule in tab "intranet ingress".

Please fix this.

Thanks,
Alex

负载均衡器一更新就报错

每次更新负载均衡器的时候就报如下错误,但实际上这个 LoadBalanceId并没有错误,更不是找不到,我怀疑这个和删除SLB需要手机短信验证有关。

Error applying plan:

2 error(s) occurred:

* alicloud_slb_attachment.default: 1 error(s) occurred:

* alicloud_slb_attachment.default: Aliyun API Error: RequestId: D078414B-5528-4D7F-A35C-0EB5AF1B7411 Status Code: 404 Code: InvalidLoadBalancerId.NotFound Message: LoadBalancerId does not exist.
* null_resource.docker_rancher: 1 error(s) occurred:

* Script exited with non-zero exit status: 127

EIP address isn't shown in outputs when applying first time

hi.
I create an eip and ecs, and associate eip with ecs.
And I would like to output eip address after terraform apply.
But currently eip address isn't shown because not waiting for giving ipaddress (maybe).
I think you should wait for giving eip address.

Code is below.

resource "alicloud_eip" "eip" {
  internet_charge_type = "PayByTraffic"
}

resource "alicloud_eip_association" "eip_asso" {
  allocation_id = "${alicloud_eip.eip.id}"
  instance_id   = "${alicloud_instance.web.id}"
}

resource "alicloud_instance" "web" {
  instance_name = "terraform-ecs"
  host_name = "wordpress-ecs"
  availability_zone = "${var.zone}"
  image_id = "centos_7_3_64_40G_base_20170322.vhd"
  instance_type = "ecs.n1.small"
  io_optimized = "optimized"
  system_disk_category = "cloud_efficiency"
  security_groups = ["${alicloud_security_group.sg.id}"]
  vswitch_id = "${alicloud_vswitch.vsw.id}"
  password = "${var.password}"
}
output "wordpress_eip" {
    value = "${alicloud_eip.eip.ip_address}"
}

Of course, after terraform apply I execute terraform refresh, then I can confirm eip address.

Always failed when allocating public IP address to ecs

Hi there,

I encountered the problem as below, when I was creating a ecs instance in our VPC. However, if I run terraform apply again, it will be successful.

This error always happens to me, almost every single time I run terraform apply.

Here is the error log,

* alicloud_instance.test: allocateIpAndBandWidthRelative err: &errors.errorString{s:"[DEBUG] AllocatePublicIpAddress for instance got error: &common.Error{ErrorResponse:common.ErrorResponse{Response:common.Response{RequestId:\"06FD4F80-B48A-4C02-A213-4486885A2DFD\"}, HostId:
\"ecs-cn-hangzhou.aliyuncs.com\", Code:\"Forbidden.InstanceNotFound\", Message:\"The specified Instance is not found, so we cann't get enough information to check permission in RAM.\"}, StatusCode:404}"}

Do you think it is because terraform alicloud provider allocates the public IP address before the ecs instance is created?

Thanks for your help,

Tian

Docs for the new resources

I am so excited to see this project is actively developed.

But now I can only check here for docs,
is there any place I can check and see the docs for the new resources.

Thanks
Xiaoyu

data alicloud_images only filter the first page of images

current now the data alicloud_images only filter the first page response of DescribeImages, which only 10 images filterd, that the below example does not work.

data "alicloud_images" "ubuntu" {
  name_regex = "^ubuntu_14"
  owners     = "system"
}
* data.alicloud_images.ubuntu: Your query returned no results. Please change your search criteria and try again.

Errors when use Group Attribute

I had the following erros when trying to apply security group. The security group defined in tf file is successfully created but somehow the API fails to pass the returned json.

» terraform apply -var-file="alicloud.tfvars"
[WARN] /Users/tal/local/bin/terraform-provider-alicloud overrides an internal plugin for alicloud-provider.
  If you did not expect to see this message you will need to remove the old plugin.
  See https://www.terraform.io/docs/internals/internal-plugins.html
alicloud_security_group.default: Refreshing state... (ID: sg-6we0st6pqhtrt9gh5kn0)
Error refreshing state: 1 error(s) occurred:

* alicloud_security_group.default: Error DescribeSecurityGroupAttribute: &common.Error{ErrorResponse:common.ErrorResponse{Response:common.Response{RequestId:""}, HostId:"", Code:"AliyunGoClientFailure", Message:"unexpected end of JSON input"}, StatusCode:-1}

Terraform state file is not correct for security group rules

Hi,
I'm trying to create security groups in aliyun by using terraform alicloud provider.
My configurations look like this,

## Bastion
resource "alicloud_security_group" "bastion" {
  name = "bastion_sg_${var.environment}"
  description = "Bastion host security group"
  vpc_id = "${var.vpc_id}"
}

resource "alicloud_security_group_rule" "bastion_allow_icmp_from_vpc" {
  security_group_id = "${alicloud_security_group.bastion.id}"

  type = "ingress"
  policy = "accept"
  port_range = "-1/-1"
  ip_protocol = "icmp"
  nic_type = "intranet"
  priority = 1

  cidr_ip = "${var.vpc_cidr}"
}

resource "alicloud_security_group_rule" "bastion_allow_icmp_from_vpn" {
  count = "${length(compact(var.vpn_ip_list))}"
  security_group_id = "${alicloud_security_group.bastion.id}"

  type = "ingress"
  policy = "accept"
  port_range = "-1/-1"
  ip_protocol = "icmp"
  nic_type = "intranet"
  priority = 1

  cidr_ip = "${element(var.vpn_ip_list, count.index)}"
}

resource "alicloud_security_group_rule" "bastion_allow_ssh_from_vpn" {
  count = "${length(compact(var.vpn_ip_list))}"
  security_group_id = "${alicloud_security_group.bastion.id}"

  type = "ingress"
  policy = "accept"
  port_range = "22/22"
  ip_protocol = "tcp"
  nic_type = "intranet"
  priority = 1

  cidr_ip = "${element(var.vpn_ip_list, count.index)}"
}

resource "alicloud_security_group_rule" "bastion_outbound_all" {
  security_group_id = "${alicloud_security_group.bastion.id}"

  type = "egress"
  policy = "accept"
  port_range = "-1/-1"
  ip_protocol = "all"
  nic_type = "intranet"
  priority = 1

  cidr_ip = "0.0.0.0/0"
}


# spark
resource "alicloud_security_group" "spark" {
  name = "spark_sg_${var.environment}"
  description = "Spark Cluster security group"
  vpc_id = "${var.vpc_id}"
}

resource "alicloud_security_group_rule" "spark_allow_icmp_from_vpc" {
  security_group_id = "${alicloud_security_group.spark.id}"

  type = "ingress"
  policy = "accept"
  port_range = "-1/-1"
  ip_protocol = "icmp"
  nic_type = "intranet"
  priority = 1

  cidr_ip = "${var.vpc_cidr}"
}

resource "alicloud_security_group_rule" "spark_allow_icmp_from_vpn" {
  count = "${length(compact(var.vpn_ip_list))}"
  security_group_id = "${alicloud_security_group.spark.id}"

  type = "ingress"
  policy = "accept"
  port_range = "-1/-1"
  ip_protocol = "icmp"
  nic_type = "intranet"
  priority = 1

  cidr_ip = "${var.vpn_ip_list[count.index]}"
}

resource "alicloud_security_group_rule" "spark_allow_ssh_from_bastion" {
  security_group_id = "${alicloud_security_group.spark.id}"
  source_security_group_id  = "${alicloud_security_group.bastion.id}"

  type = "ingress"
  policy = "accept"
  port_range = "22/22"
  ip_protocol = "tcp"
  nic_type = "intranet"
  priority = 1
}

resource "alicloud_security_group_rule" "spark_master_ui_port" {
  security_group_id = "${alicloud_security_group.spark.id}"
  source_security_group_id  = "${alicloud_security_group.bastion.id}"

  type = "ingress"
  policy = "accept"
  port_range = "8080/8080"
  ip_protocol = "tcp"
  nic_type = "intranet"
  priority = 1
}

resource "alicloud_security_group_rule" "spark_worker_ui_port" {
  security_group_id = "${alicloud_security_group.spark.id}"
  source_security_group_id  = "${alicloud_security_group.bastion.id}"

  # open 100 ports for web ui access
  # so we can have 100 workers at most
  type = "ingress"
  policy = "accept"
  port_range = "8081/8181"
  ip_protocol = "tcp"
  nic_type = "intranet"
  priority = 1
}

resource "alicloud_security_group_rule" "spark_master_rest_port" {
  security_group_id = "${alicloud_security_group.spark.id}"
  source_security_group_id  = "${alicloud_security_group.bastion.id}"

  type = "ingress"
  policy = "accept"
  port_range = "6066/6066"
  ip_protocol = "tcp"
  nic_type = "intranet"
  priority = 1
}

resource "alicloud_security_group_rule" "spark_master_outbound_all" {
  security_group_id = "${alicloud_security_group.spark.id}"

  type = "egress"
  policy = "accept"
  port_range = "-1/-1"
  ip_protocol = "all"
  nic_type = "intranet"
  priority = 1

  cidr_ip = "0.0.0.0/0"
}

And when I ran terraform plan again without any changes, I got a lot of forces new resource

-/+ module.sg.alicloud_security_group_rule.bastion_allow_icmp_from_vpn.0
    cidr_ip:           "50.255.XXX.XXX/32" => "76.250.XXX.XXX/32" (forces new resource)
    ip_protocol:       "icmp" => "icmp"
    nic_type:          "intranet" => "intranet"
    policy:            "accept" => "accept"
    port_range:        "-1/-1" => "-1/-1"
    priority:          "1" => "1"
    security_group_id: "sg-2ze6yeq2uydogw4l3w57" => "sg-2ze6yeq2uydogw4l3w57"
    type:              "ingress" => "ingress"

Then, I compared the terraform apply output with terraform state file, and found that the cidr value of the attributes is not correct.

module.sg.alicloud_security_group_rule.bastion_allow_icmp_from_vpn.0: Creating...
  cidr_ip:           "" => "76.250.XXX.XXX/32"
  ip_protocol:       "" => "icmp"
  nic_type:          "" => "intranet"
  policy:            "" => "accept"
  port_range:        "" => "-1/-1"
  priority:          "" => "1"
  security_group_id: "" => "sg-2ze6yeq2uydogw4l3w57"
  type:              "" => "ingress"

"alicloud_security_group_rule.bastion_allow_icmp_from_vpn.0": {
    "type": "alicloud_security_group_rule",
    "depends_on": [
        "alicloud_security_group.bastion"
    ],
    "primary": {
        "id": "sg-2ze6yeq2uydogw4l3w57:ingress:icmp:-1/-1:intranet",
        "attributes": {
            "cidr_ip": "50.255.XXX.XXX/32",
            "id": "sg-2ze6yeq2uydogw4l3w57:ingress:icmp:-1/-1:intranet",
            "ip_protocol": "icmp",
            "nic_type": "intranet",
            "policy": "accept",
            "port_range": "-1/-1",
            "priority": "1",
            "security_group_id": "sg-2ze6yeq2uydogw4l3w57",
            "source_group_owner_account": "",
            "source_security_group_id": "",
            "type": "ingress"
        },
        "meta": {},
        "tainted": false
    },
    "deposed": [],
    "provider": ""
},

Could you please take a look too see if it is a bug in terraform or in alicloud terraform provider?

Thanks a lot,

Tian

allocate_public_ip false not obeyed

If you set allocate_public_ip = false and accidentally set internet_max_bandwidth_in or internet_max_bandwidth_out to any value, the instance will be assigned a public ip address. The expected behavior would be to obey allocate_public_ip and ignore the internet_max_bandwidth_* directives.

Sametimes fail to enable SLB listener

Hi
I'm @mosuke5.
I'm trying to create SLB instances and listeners by terraform.
But sometimes fail to enable SLB listeners, even if I execute same template file.

The code which I execute is below.

# Create a new load balancer for classic
resource "alicloud_slb" "slb" {
  name                 = "terraform-slb"
  internet             = true
  internet_charge_type = "paybytraffic"

  listener = [
    {
      "instance_port" = "80"
      "lb_port"       = "80"
      "lb_protocol"   = "http"
      "bandwidth"     = "10"
      "sticky_session" = "on"
      "sticky_session_type" = "insert"
      "cookie_timeout" = "1"
    }
  ]
}

This is output.
Sometimes success, sometimes fail.

% TF_LOG=trace TF_LOG_PATH=./terraform.log terraform apply -var-file="terraform.tfvars"
alicloud_slb.slb: Creating...
  address:                                       "" => "<computed>"
  bandwidth:                                     "" => "<computed>"
  internet:                                      "" => "true"
  internet_charge_type:                          "" => "paybytraffic"
  listener.#:                                    "" => "1"
  listener.3882438748.bandwidth:                 "" => "10"
  listener.3882438748.cookie:                    "" => ""
  listener.3882438748.cookie_timeout:            "" => "1"
  listener.3882438748.health_check:              "" => "off"
  listener.3882438748.health_check_connect_port: "" => ""
  listener.3882438748.health_check_domain:       "" => ""
  listener.3882438748.health_check_http_code:    "" => ""
  listener.3882438748.health_check_interval:     "" => ""
  listener.3882438748.health_check_timeout:      "" => ""
  listener.3882438748.health_check_type:         "" => "tcp"
  listener.3882438748.health_check_uri:          "" => ""
  listener.3882438748.healthy_threshold:         "" => ""
  listener.3882438748.instance_port:             "" => "80"
  listener.3882438748.lb_port:                   "" => "80"
  listener.3882438748.lb_protocol:               "" => "http"
  listener.3882438748.persistence_timeout:       "" => "0"
  listener.3882438748.scheduler:                 "" => "wrr"
  listener.3882438748.ssl_certificate_id:        "" => ""
  listener.3882438748.sticky_session:            "" => "on"
  listener.3882438748.sticky_session_type:       "" => "insert"
  listener.3882438748.unhealthy_threshold:       "" => ""
  name:                                          "" => "terraform-slb"
alicloud_slb.slb: Creation complete (ID: lb-e9bhpn351872r9r41694n)

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.

State path:
%
% terraform destroy
Do you really want to destroy?
  Terraform will delete all your managed infrastructure.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

alicloud_slb.slb: Refreshing state... (ID: lb-e9bhpn351872r9r41694n)
alicloud_slb.slb: Destroying... (ID: lb-e9bhpn351872r9r41694n)
alicloud_slb.slb: Destruction complete

Destroy complete! Resources: 1 destroyed.

% TF_LOG=trace TF_LOG_PATH=./terraform.log terraform apply -var-file="terraform.tfvars"
alicloud_slb.slb: Creating...
  address:                                       "" => "<computed>"
  bandwidth:                                     "" => "<computed>"
  internet:                                      "" => "true"
  internet_charge_type:                          "" => "paybytraffic"
  listener.#:                                    "" => "1"
  listener.3882438748.bandwidth:                 "" => "10"
  listener.3882438748.cookie:                    "" => ""
  listener.3882438748.cookie_timeout:            "" => "1"
  listener.3882438748.health_check:              "" => "off"
  listener.3882438748.health_check_connect_port: "" => ""
  listener.3882438748.health_check_domain:       "" => ""
  listener.3882438748.health_check_http_code:    "" => ""
  listener.3882438748.health_check_interval:     "" => ""
  listener.3882438748.health_check_timeout:      "" => ""
  listener.3882438748.health_check_type:         "" => "tcp"
  listener.3882438748.health_check_uri:          "" => ""
  listener.3882438748.healthy_threshold:         "" => ""
  listener.3882438748.instance_port:             "" => "80"
  listener.3882438748.lb_port:                   "" => "80"
  listener.3882438748.lb_protocol:               "" => "http"
  listener.3882438748.persistence_timeout:       "" => "0"
  listener.3882438748.scheduler:                 "" => "wrr"
  listener.3882438748.ssl_certificate_id:        "" => ""
  listener.3882438748.sticky_session:            "" => "on"
  listener.3882438748.sticky_session_type:       "" => "insert"
  listener.3882438748.unhealthy_threshold:       "" => ""
  name:                                          "" => "terraform-slb"
Error applying plan:

1 error(s) occurred:

* alicloud_slb.slb: 1 error(s) occurred:

* alicloud_slb.slb: Failure add SLB listeners: &common.Error{ErrorResponse:common.ErrorResponse{Response:common.Response{RequestId:"E232A5DD-99CE-4E9F-985F-8E37D5B30B00"}, HostId:"slb.ap-northeast-1.aliyuncs.com", Code:"UnsupportedOperation", Message:"The specified action is not supported."}, StatusCode:400}

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

didn't show changing about slb sticky_session

Hi
Sorry for posting a lot issues.
I changed sticky_session parameter from 'on' to 'off', but terraform plan didn't show this changing. Is this right??

Please check this specification.

% git diff
diff --git a/slb_sample/terraform.tf b/slb_sample/terraform.tf
index 81d1dae..d47fd04 100644
--- a/slb_sample/terraform.tf
+++ b/slb_sample/terraform.tf
@@ -22,91 +22,91 @@ resource "alicloud_slb" "slb" {
       "lb_port"       = "80"
       "lb_protocol"   = "http"
       "bandwidth"     = "10"
-      "sticky_session" = "on"
-      "sticky_session_type" = "insert"
-      "cookie_timeout" = "1"
+      "sticky_session" = "off"
+#      "sticky_session_type" = "insert"
+#      "cookie_timeout" = "1"
     }
   ]
 }
% terraform plan -var-file="terraform.tfvars"
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

alicloud_slb.slb: Refreshing state... (ID: lb-e9bbbifbkxlodmhgnsipq)
No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, Terraform
doesn't need to do anything.

How long update

Can you tell me the frequency of the project update, will also increase the support of other Ali cloud resources?

Thank you.

can ecs instance do remote-exec ?

senario:

  1. admin install docker daeon on ecs instance
  2. admin defined a RDS instance by terraform
  3. admin want to run a container connected to RDS instance

In this case, the admin cannot get db informations before RDS instance created, so user_data is no used. The admin need provisioner like this:

  provisioner "remote-exec" {
    inline = [
      "curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -",
      "sudo add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\"",
      "sudo apt-get update",
      "sudo apt-get install docker-ce -y",
      "sudo docker run -d --restart=unless-stopped -p 8080:8080 -p 9345:9345 rancher/server --advertise-address eth0 --db-host ${aws_db_instance.system.address} --db-port 3306 --db-user ${var.db_user} --db-pass ${var.db_password} --db-name ${var.db_name}"
    ]
  }

This is a example from aws terraform files. How about alicloud?

Error when trying to create RDS

I have a RDS definition as below

# RDSの作成
resource "alicloud_db_instance" "db" {
    engine = "MySQL"
    engine_version = "5.6"
    vswitch_id = "${alicloud_vswitch.vsw.id}"
    security_ips = ["${alicloud_instance.web.private_ip}"]
    db_instance_class = "rds.mysql.t1.small"
    db_instance_storage = "10"
    db_instance_net_type = "Intranet"
}

When trying to apply this definition, I got following error messages

** 1st time terraform apply **

1 error(s) occurred:

* alicloud_db_instance.db: 1 error(s) occurred:

* alicloud_db_instance.db: WaitForInstance Running got error: &common.Error{ErrorResponse:common.ErrorResponse{Response:common.Response{RequestId:"D5D34CFD-9707-4469-8DB1-C78DD2F72CD3"}, HostId:"rds.ap-northeast-1.aliyuncs.com", Code:"Forbidden.InstanceNotFound", Message:"The specified instance is not found."}, StatusCode:404}

** 2nd time terraform apply **

1 error(s) occurred:

* alicloud_db_instance.db: 1 error(s) occurred:

* alicloud_db_instance.db: Error modify security ips 192.168.2.81: &common.Error{ErrorResponse:common.ErrorResponse{Response:common.Response{RequestId:"0F86BD27-49FF-49F6-BA63-1DA71FC3C0B2"}, HostId:"rds.ap-northeast-1.aliyuncs.com", Code:"OperationDenied.DBInstanceStatus", Message:"The operation is not permitted due to status of instance."}, StatusCode:403}

I think the provider should wait until the instance is fully initialized

Cannot create SLB Listener using RAM account

I saw the following message when trying to create SLB listener using RAM account.

* alicloud_slb.techblog-lb: 1 error(s) occurred:

* alicloud_slb.techblog-lb: Failure add SLB listeners: &errors.errorString{s:"Server Certificated Id cann't be null"}

My tf file is

resource "alicloud_slb" "techblog-lb" {
  name                 = "techblog-lb"
  internet             = true
  internet_charge_type = "paybytraffic"
  bandwidth            = 5

  listener = [
    {
      "instance_port" = "80"
      "lb_port"       = "80"
      "lb_protocol"   = "http"
      "bandwidth"     = "5"
    },
    {
      "instance_port" = "443"
      "lb_port"       = "443"
      "lb_protocol"   = "https"
      "bandwidth"     = "5"
    }
  ]
}

SLB: invalid or unknown key: PersistenceTimeout

Hello.

I'm trying to configure SLB to use multiple listeners and for some I want persistense for connection.
I see that API supports PersistenceTimeout option and it defined in resource_alicloud_slb.go as well. But when I try to describe it like this, I've got invalid or unknown key: PersistenceTimeout error:

resource "alicloud_slb" test-slb" {
  name = "test-slb"
  internet_charge_type = "paybytraffic"
  internet = true

  listener = [
  {
    "instance_port" = "443"
    "lb_port" = "443"
    "lb_protocol" = "tcp"
    "bandwidth" = "100"
  }]

  listener = [
  {
    "instance_port" = "8100"
    "lb_port" = "8100"
    "lb_protocol" = "tcp"
    "bandwidth" = "100"
    "PersistenceTimeout" = "3600"
  }]

  depends_on = [ "alicloud_vpc.main"]
}

What I'm doing wrong? Maybe binary for linux needs an update?

Thanks,
Alex

Failed to create db instance

When creating db instance, I got the following error:

Error applying plan:

1 error(s) occurred:

  • alicloud_db_instance.rds: 1 error(s) occurred:

  • alicloud_db_instance.rds: WaitForInstance Running got error: &common.Error{ErrorResponse:common.ErrorResponse{Response:common.Response{RequestId:"9815849C-D79F-4ACC-9376-9C2235EDABAE"}, HostId:"rds.aliyuncs.com", Code:"InvalidDBInstanceId.NotFound", Message:"DBInstanceIdentifier does not refer to an existing DB instance."}, StatusCode:400}

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

The tf file:
resource "alicloud_db_instance" "rds" {
engine = "${var.engine}"
engine_version = "${var.engine_version}"
db_instance_class = "${var.db_instance_class}"
db_instance_storage = "${var.db_instance_storage}"
instance_charge_type = "${var.db_instance_charge_type}"
period = "${var.period}"
#zone_id = "${var.zone_id}"
allocate_public_connection = true
db_instance_net_type = "${var.db_instance_net_type}"
instance_network_type = "${var.instance_network_type}"
vswitch_id = "${var.vswitch_id}"
master_user_name = "${var.db_user_name}"
master_user_password = "${var.db_password}"
preferred_backup_time = "${var.preferred_backup_time}"
preferred_backup_period = "${var.preferred_backup_period}"
backup_retention_period = "${var.backup_retention_period}"
db_mappings = [
{
db_name = "dscp"
character_set_name = "utf8mb4"
},
{
db_name = "try_dscp"
character_set_name = "utf8mb4"
}
]
security_ips = ["${alicloud_instance.web1.private_ip}", "${alicloud_instance.web2.private_ip}", "202.131.80.74", "202.131.84.134", "211.24.114.202"]

provisioner local-exec {
command = "echo ${self.connections} >> rds_connections.txt"
}
}

The instance was created partially successfully. The instance was created but the user and database were not created.

alicloud_instance option system_disk_size not working

Here is terraform resource definition I used ;

resource "alicloud_instance" "test-server" {
instance_name = "test-server"
description = "Test server"
instance_charge_type = "PrePaid"
period = "12"
vswitch_id = "vsw-xxxxxxxxxxxxx"
host_name = "test-server"
image_id = "centos_7_2_64_40G_base_20170222.vhd"
instance_type = "ecs.n4.4xlarge"
count = "1"
availability_zone = "ap-southeast-1a"
security_groups = ["sg-xxxxxxxxxxxxx"]
allocate_public_ip = "false"
// internet_charge_type = "PayByBandwidth"
// internet_max_bandwidth_out = "0"
// internet_max_bandwidth_in = "200"
password = "xxxxxxxxxxxxx"
io_optimized = "optimized"
system_disk_category = "cloud_efficiency"
system_disk_size = "300"
tags {
"Name" = "test-server"
"Owner" = "Test owner"
}
}

system_disk_size = "300" is in the definition but instance created with 40G disk.

[xxxxxx@localhost ~]$ terraform version
Terraform v0.8.8

Thanks,

everytime change security_ips of rds

Hi. I created 2 ecs instances and rds and add those instances to security_ips.
Everytime I execute terraform plan, following changes is shown.
Please check it.

~ alicloud_db_instance.rds
    security_ips.0: "192.168.1.179" => "192.168.1.181"
    security_ips.1: "192.168.1.181" => "192.168.1.179"

Error with RAM user's API KEY

Hi

I'm @mosuke5.
I encountered the problem as below, when I executed terraform with RAM user's API KEY.

% terraform apply -var-file="terraform.tfvars"
alicloud_instance.web: Creating...
  allocate_public_ip:         "" => "false"
  availability_zone:          "" => "ap-northeast-1a"
  host_name:                  "" => "<computed>"
  image_id:                   "" => "m-6wec065ood8fic52mh6v"
  instance_name:              "" => "terraform-ecs"
  instance_type:              "" => "ecs.n4.small"
  io_optimized:               "" => "optimized"
  private_ip:                 "" => "<computed>"
  public_ip:                  "" => "<computed>"
  security_groups.#:          "" => "1"
  security_groups.1231334511: "" => "sg-6wejasz5tqswisp1udo1"
  status:                     "" => "<computed>"
  subnet_id:                  "" => "<computed>"
  system_disk_category:       "" => "cloud_efficiency"
  system_disk_size:           "" => "<computed>"
  vswitch_id:                 "" => "vsw-6wetepk241qkbdejqjosu"
Error applying plan:

1 error(s) occurred:

* alicloud_instance.web: 1 error(s) occurred:

* alicloud_instance.web: Modify instance attribute got error: &common.Error{ErrorResponse:common.ErrorResponse{Response:common.Response{RequestId:"4EDB304B-9710-4D6C-BA5D-CD4F347073B6"}, HostId:"ecs.ap-northeast-1.aliyuncs.com", Code:"Forbidden.InstanceNotFound", Message:"The specified Instance is not found, so we cann't get enough information to check permission in RAM."}, StatusCode:404}

If I execute terraform with parent account's API KEY, it is successful.
And this RAM user has "AdministratorAccess" privilege.

Do you know this problem?

Cannot set tags when create new ecs instance

I use terraform to create ecs instance in aliyun. But when I set tags for new ecs intance, I always get:

* alicloud_instance.test: Set tags for instance got error: &errors.errorString{s:"Creating tags got error: Aliyun API Error: RequestId: 0E38C747-A033-
4517-B0AE-D42CAFBE53FA Status Code: 404 Code: InvalidResourceId.NotFound Message: The specified ResourceId is not found in our records."}

And my code looks like this,

resource "alicloud_instance" "test" {
  instance_type = "${var.instance_type}"
  image_id = "${var.image_id}"
  count = "${var.instance_count}"
  availability_zone = "${element(split(",", var.availability_zones), count.index)}"
  instance_name = "${var.role}${count.index+1}"
  host_name = "${var.role}${count.index+1}"

  # system disk
  io_optimized = "${var.io_optimized}"
  system_disk_category = "${var.system_disk_category}"
  system_disk_size = "${var.system_disk_size}"

  # networking
  allocate_public_ip = true
  security_groups = ["${split(",", var.security_groups)}"]
  internet_charge_type = "${var.internet_charge_type}"
  internet_max_bandwidth_in = "${var.internet_max_bandwidth_in}"
  internet_max_bandwidth_out = "${var.internet_max_bandwidth_out}"
  vswitch_id = "${var.vswitch_id}"

  instance_charge_type = "PostPaid"

  tags {
    Owner = "${var.owner}"
    Environment = "${var.environment}"
    Role = "${var.role}"
  }
}

Is there anything wrong?

Thanks for your help,

Tian

Can't create databases in RDS

In .tf file, I used:

  master_user_name = "${var.db_user_name}"
  master_user_password = "${var.db_password}"
  preferred_backup_time = "${var.preferred_backup_time}"
  db_mappings = [
    {
      db_name = "dscp"
      character_set_name = "utf8mb4"
    },
    {
      db_name = "try_dscp"
      character_set_name = "utf8mb4"
    }
  ]

The user has been created successfully, but Terraform failed to create the databases specified.
The error response is:

Error applying plan:

1 error(s) occurred:

  • alicloud_db_instance.rds: 1 error(s) occurred:

  • alicloud_db_instance.rds: Failure create database try_dscp: &common.Error{ErrorResponse:common.ErrorResponse{Response:common.Response{RequestId:"B5E194AC-B38E-4134-838B-A449DA64519A"}, HostId:"rds.aliyuncs.com", Code:"OperationDenied.DBInstanceStatus", Message:"The operation is not permitted due to status of instance."}, StatusCode:403}

Seems the creation failed because the status of RDS was "creating",
how to fix this issue ?

Security group not created with expected rules

Terraform code as following:

resource "alicloud_security_group_rule" "xxxx-backend-to-database" {
  type = "ingress"
  ip_protocol = "tcp"
  nic_type = "intranet"
  policy = "accept"
  port_range = "3306/3306"
  priority = 50
  security_group_id = "${alicloud_security_group.prod-xxxx-database.id}"
  source_security_group_id = "${alicloud_security_group.prod-xxxx-backend.id}"
}

And during creation, I can see message as:

alicloud_security_group_rule.xxxx-backend-to-database: Creating...
  cidr_ip:                  "" => "0.0.0.0/0"
  ip_protocol:              "" => "tcp"
  nic_type:                 "" => "intranet"
  policy:                   "" => "accept"
  port_range:               "" => "3306/3306"
  priority:                 "" => "50"
  security_group_id:        "" => "sg-2zehi5ycq053axcby495"
  source_security_group_id: "" => "sg-2zecpv7kbyzs3g4dx7yr"
  type:                     "" => "ingress"
alicloud_security_group_rule.xxxx-backend-to-database: Creation complete

And finally the security group is created with cidr_ip '0.0.0.0/0' instead of the source security group id: sg-2zecpv7kbyzs3g4dx7yr

Unable to create cloud disk

Hi, I have a terraform script to create cloud disk. When the script is run, I got following errors

* alicloud_disk.disks.0: CreateDisk got a error: &common.Error{ErrorResponse:common.ErrorResponse{Response:common.Response{RequestId:"960D174D-69D8-4085-9190-3F4F4E1DDC95"}, HostId:"ecs.ap-northeast-1.aliyuncs.com", Code:"Forbidden.RAM", Message:"User not authorized to operate on the specified resource, or this API doesn't support RAM."}, StatusCode:403}

I used to run this script without errors. My account is RAM account with Administrator privilegess.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.