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

provider/alicloud: Fix allocating public ip bug #15049

Merged
merged 2 commits into from
Jun 5, 2017

Conversation

xiaozhu36
Copy link
Contributor

This PR fixed the bug that ensure ecs instance is already existed before allocating its public ip.

In addition, return error when some one operation failed.

@xiaozhu36 xiaozhu36 changed the title fix allocating public ip bug provider/alicloud: Fix allocating public ip bug Jun 4, 2017
@stack72
Copy link
Contributor

stack72 commented Jun 5, 2017

Hi @xiaozhu36

Thanks for the work here - please can you give me a config that i can use to test that this is working as expected?

Thanks

Paul

@xiaozhu36
Copy link
Contributor Author

xiaozhu36 commented Jun 5, 2017

Hi @stack72

Thanks you for your feedback. I have run the testcase about allocating public ip for the instance and the result as follows:
TF_ACC=1 go test ./alicloud -v -run=TestAccAlicloudInstance_associatePublicIP -timeout 120m
=== RUN TestAccAlicloudInstance_associatePublicIP
--- PASS: TestAccAlicloudInstance_associatePublicIP (462.94s)
PASS
ok github.com/alibaba/terraform-provider/alicloud 207.031s

In addition, above testcase applies to pay-as-you-go instance, and I also used the following example to test allocating public ip for pay-monthly instance, and the result is working as expected.

data "alicloud_zones" "default" {
"available_disk_category"= "cloud_efficiency"
"available_resource_creation"= "VSwitch"
}

resource "alicloud_vpc" "foo" {
name = "tf_test_foo"
cidr_block = "172.16.0.0/12"
}

resource "alicloud_vswitch" "foo" {
vpc_id = "${alicloud_vpc.foo.id}"
cidr_block = "172.16.0.0/24"
availability_zone = "${data.alicloud_zones.default.zones.0.id}"
}

resource "alicloud_security_group" "tf_test_foo" {
name = "tf_test_foo"
description = "foo"
vpc_id = "${alicloud_vpc.foo.id}"
}

resource "alicloud_instance" "foo" {
# cn-beijing
security_groups = ["${alicloud_security_group.tf_test_foo.id}"]
vswitch_id = "${alicloud_vswitch.foo.id}"
allocate_public_ip = "true"
internet_max_bandwidth_out = 5
internet_charge_type = "PayByBandwidth"
instance_charge_type = "PrePaid"
period = 1
# series II
instance_type = "ecs.n1.medium"
io_optimized = "optimized"
system_disk_category = "cloud_efficiency"
image_id = "ubuntu_140405_32_40G_cloudinit_20161115.vhd"
instance_name = "test_foo"
}

Thanks
Guimin He

@stack72
Copy link
Contributor

stack72 commented Jun 5, 2017

Thanks for this - LGTM!

@stack72 stack72 merged commit 4c16fa9 into hashicorp:master Jun 5, 2017
@ghost
Copy link

ghost commented Apr 11, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants