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

New Resource "alicloud_cs_kubernetes" #414

Merged
merged 1 commit into from
Mar 16, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ script:
- govendor fetch github.com/denverdino/aliyungo/...
- govendor fetch github.com:aliyun/aliyun-oss-go-sdk/...
- govendor fetch github.com/hashicorp/terraform/...
- govendor fetch github.com/aliyun/alibaba-cloud-sdk-go/sdk
- govendor fetch github.com/aliyun/alibaba-cloud-sdk-go/services/vpc
- govendor fetch github.com/aliyun/alibaba-cloud-sdk-go/services/rds
- make test
branches:
only:
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
## 1.8.2 (Unreleased)

IMPROVEMENTS:

- *New Resource*: _alicloud_cs_kubernetes_ (([#412](https://github.com/alibaba/terraform-provider/pull/412)))
- Modify _alicloud_container_cluster_ to _alicloud_cs_swarm_ (([#412](https://github.com/alibaba/terraform-provider/pull/412)))


BUG FIXES:

- Fix vpc description validate - Improve some examples (([#411](https://github.com/alibaba/terraform-provider/pull/411)))
- Fix vpc description validate (([#411](https://github.com/alibaba/terraform-provider/pull/411)))
- Add waiting time after ECS bind ECS to ensure network is ok (([#412](https://github.com/alibaba/terraform-provider/pull/412)))

## 1.8.1 (Unrelease)

Expand Down
1 change: 1 addition & 0 deletions alicloud/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const (
Available = Status("Available")
Unavailable = Status("Unavailable")
Modifying = Status("Modifying")
Deleting = Status("Deleting")

Associating = Status("Associating")
Unassociating = Status("Unassociating")
Expand Down
2 changes: 1 addition & 1 deletion alicloud/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func (c *Config) getAuthCredential(stsSupported bool) auth.Credential {
}

func getUserAgent() string {
return fmt.Sprintf("HashiCorp-Terraform-v%s", terraform.VersionString())
return fmt.Sprintf("HashiCorp-Terraform-v%s", strings.TrimSuffix(terraform.VersionString(), "-dev"))
}

func getTransport() *http.Transport {
Expand Down
3 changes: 3 additions & 0 deletions alicloud/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ const (

RouterInterfaceIncorrectStatus = "IncorrectStatus"
DependencyViolationRouterInterfaceReferedByRouteEntry = "DependencyViolation.RouterInterfaceReferedByRouteEntry"

// CS
ErrorClusterNameAlreadyExist = "ErrorClusterNameAlreadyExist"
)

// An Error represents a custom error for Terraform failure response
Expand Down
7 changes: 7 additions & 0 deletions alicloud/extension_ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,10 @@ var SupportedDiskCategory = map[ecs.DiskCategory]ecs.DiskCategory{
ecs.DiskCategoryCloud: ecs.DiskCategoryCloud}

const AllPortRange = "-1/-1"

const (
KubernetesImageId = "centos_7"
KubernetesMasterNumber = 3
KubernetesVersion = "1.9.3"
KubernetesDockerVersion = "17.06.2-ce-1"
)
31 changes: 31 additions & 0 deletions alicloud/import_alicloud_cs_kubernetes_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package alicloud

import (
"testing"

"github.com/hashicorp/terraform/helper/resource"
)

func TestAccAlicloudCSKubernetes_import(t *testing.T) {
resourceName := "alicloud_cs_kubernetes.k8s"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckContainerClusterDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccContainerKubernetes_basic,
},

resource.TestStep{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"name_prefix", "new_nat_gateway", "master_instance_type", "worker_instance_type",
"pod_cidr", "service_cidr", "enable_ssh", "password", "master_disk_size", "master_disk_category",
"worker_disk_size", "worker_disk_category", "install_cloud_monitor"},
},
},
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccAlicloudContainerCluster_importBasic(t *testing.T) {
func TestAccAlicloudCSSwarm_importBasic(t *testing.T) {
resourceName := "alicloud_container_cluster.cs_vpc"

resource.Test(t, resource.TestCase{
Expand All @@ -15,14 +15,14 @@ func TestAccAlicloudContainerCluster_importBasic(t *testing.T) {
CheckDestroy: testAccCheckContainerClusterDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccContainerCluster_vpc,
Config: testAccCSSwarm_basic,
},

resource.TestStep{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"cidr_block", "disk_category", "disk_size", "image_id", "instance_type", "password"},
ImportStateVerifyIgnore: []string{"name_prefix", "cidr_block", "disk_category", "disk_size", "image_id", "instance_type", "password"},
},
},
})
Expand Down
4 changes: 3 additions & 1 deletion alicloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ func Provider() terraform.ResourceProvider {
"alicloud_ram_user_policy_attachment": resourceAlicloudRamUserPolicyAtatchment(),
"alicloud_ram_role_policy_attachment": resourceAlicloudRamRolePolicyAttachment(),
"alicloud_ram_group_policy_attachment": resourceAlicloudRamGroupPolicyAtatchment(),
"alicloud_container_cluster": resourceAlicloudContainerCluster(),
"alicloud_container_cluster": resourceAlicloudCSSwarm(),
"alicloud_cs_swarm": resourceAlicloudCSSwarm(),
"alicloud_cs_kubernetes": resourceAlicloudCSKubernetes(),
"alicloud_cdn_domain": resourceAlicloudCdnDomain(),
"alicloud_router_interface": resourceAlicloudRouterInterface(),
},
Expand Down
Loading