Skip to content

Commit

Permalink
Fix284 (#312)
Browse files Browse the repository at this point in the history
* vendor latest bluemix-go

* Make account id optional

* Doc changes for container resources
  • Loading branch information
Praveengostu authored and hkantare committed Jul 6, 2018
1 parent 6fb2f36 commit b1ef55a
Show file tree
Hide file tree
Showing 24 changed files with 194 additions and 224 deletions.
2 changes: 1 addition & 1 deletion ibm/data_source_ibm_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func dataSourceIBMContainerCluster() *schema.Resource {
"account_guid": {
Description: "The bluemix account guid this cluster belongs to",
Type: schema.TypeString,
Required: true,
Optional: true,
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion ibm/data_source_ibm_container_cluster_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func dataSourceIBMContainerClusterConfig() *schema.Resource {
"account_guid": {
Description: "The bluemix account guid this cluster belongs to",
Type: schema.TypeString,
Required: true,
Optional: true,
},
"cluster_name_id": {
Description: "The name/id of the cluster",
Expand Down
11 changes: 1 addition & 10 deletions ibm/data_source_ibm_container_cluster_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,19 @@ func TestAccIBMContainerClusterConfigDataSource_WithoutOptionalFields(t *testing

func testAccCheckIBMContainerClusterDataSourceConfigWithoutOptionalFields(clustername string) string {
return fmt.Sprintf(`
data "ibm_org" "testacc_ds_org" {
org = "%s"
}
data "ibm_account" "testacc_acc" {
org_guid = "${data.ibm_org.testacc_ds_org.id}"
}
resource "ibm_container_cluster" "testacc_cluster" {
name = "%s"
datacenter = "%s"
account_guid = "${data.ibm_account.testacc_acc.id}"
worker_num = 1
machine_type = "%s"
hardware = "shared"
public_vlan_id = "%s"
private_vlan_id = "%s"
}
data "ibm_container_cluster_config" "testacc_ds_cluster" {
account_guid = "${data.ibm_account.testacc_acc.id}"
cluster_name_id = "${ibm_container_cluster.testacc_cluster.id}"
}`, cfOrganization, clustername, datacenter, machineType, publicVlanID, privateVlanID)
}`, clustername, datacenter, machineType, publicVlanID, privateVlanID)
}

func testAccCheckIBMContainerClusterDataSourceConfig(clustername string) string {
Expand Down
18 changes: 5 additions & 13 deletions ibm/data_source_ibm_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ func TestAccIBMContainerClusterDataSource_basic(t *testing.T) {
})
}

func TestAccIBMContainerClusterDataSourceWithOutOrgSpace(t *testing.T) {
func TestAccIBMContainerClusterDataSourceWithOutOrgSpaceAccount(t *testing.T) {
clusterName := fmt.Sprintf("terraform_%d", acctest.RandInt())
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccCheckIBMContainerClusterDataSourceWithOutOrgSpace(clusterName),
Config: testAccCheckIBMContainerClusterDataSourceWithOutOrgSpaceAccount(clusterName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.ibm_container_cluster.testacc_ds_cluster", "worker_count", "1"),
resource.TestCheckResourceAttr("data.ibm_container_cluster.testacc_ds_cluster", "worker_pools.#", "1"),
Expand Down Expand Up @@ -124,28 +124,20 @@ data "ibm_container_cluster" "testacc_ds_cluster" {
`, cfOrganization, cfOrganization, cfSpace, clusterName, datacenter, machineType, publicVlanID, privateVlanID, subnetID, serviceName, serviceKeyName)
}

func testAccCheckIBMContainerClusterDataSourceWithOutOrgSpace(clusterName string) string {
func testAccCheckIBMContainerClusterDataSourceWithOutOrgSpaceAccount(clusterName string) string {
return fmt.Sprintf(`
data "ibm_org" "testacc_ds_org" {
org = "%s"
}
data "ibm_account" "testacc_acc" {
org_guid = "${data.ibm_org.testacc_ds_org.id}"
}
resource "ibm_container_cluster" "testacc_cluster" {
name = "%s"
datacenter = "%s"
account_guid = "${data.ibm_account.testacc_acc.id}"
worker_num = 1
worker_num = 1
machine_type = "%s"
hardware = "shared"
public_vlan_id = "%s"
private_vlan_id = "%s"
subnet_id = ["%s"]
}
data "ibm_container_cluster" "testacc_ds_cluster" {
account_guid = "${data.ibm_account.testacc_acc.id}"
cluster_name_id = "${ibm_container_cluster.testacc_cluster.id}"
}
`, cfOrganization, clusterName, datacenter, machineType, publicVlanID, privateVlanID, subnetID)
`, clusterName, datacenter, machineType, publicVlanID, privateVlanID, subnetID)
}
2 changes: 1 addition & 1 deletion ibm/data_source_ibm_container_cluster_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func dataSourceIBMContainerClusterVersions() *schema.Resource {
"account_guid": {
Description: "The bluemix account guid this cluster belongs to",
Type: schema.TypeString,
Required: true,
Optional: true,
},
"valid_kube_versions": {
Description: "List supported kube-versions",
Expand Down
15 changes: 3 additions & 12 deletions ibm/data_source_ibm_container_cluster_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestAccIBMContainerClusterVersionsDataSource_WithoutOptionalFields(t *testi
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccCheckIBMContainerClusterVersionsDataSourceWithoutOptionalFields(),
Config: testAccCheckIBMContainerClusterVersionsDataSourceWithoutOptionalFields,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet("data.ibm_container_cluster_versions.versions", "valid_kube_versions.0"),
),
Expand Down Expand Up @@ -57,16 +57,7 @@ data "ibm_container_cluster_versions" "versions" {
`, cfOrganization, cfOrganization, cfSpace)
}

func testAccCheckIBMContainerClusterVersionsDataSourceWithoutOptionalFields() string {
return fmt.Sprintf(`
data "ibm_org" "testacc_ds_org" {
org = "%s"
}
data "ibm_account" "testacc_acc" {
org_guid = "${data.ibm_org.testacc_ds_org.id}"
}
const testAccCheckIBMContainerClusterVersionsDataSourceWithoutOptionalFields = `
data "ibm_container_cluster_versions" "versions" {
account_guid = "${data.ibm_account.testacc_acc.id}"
}
`, cfOrganization)
}
`
2 changes: 1 addition & 1 deletion ibm/data_source_ibm_container_cluster_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func dataSourceIBMContainerClusterWorker() *schema.Resource {
"account_guid": {
Description: "The bluemix account guid this cluster belongs to",
Type: schema.TypeString,
Required: true,
Optional: true,
},
},
}
Expand Down
11 changes: 1 addition & 10 deletions ibm/data_source_ibm_container_cluster_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,23 @@ func TestAccIBMContainerClusterWorkerDataSource_WithoutOptionalFields(t *testing

func testAccCheckIBMContainerClusterWorkerDataSourceConfigWithoutOptionalFields(clusterName string) string {
return fmt.Sprintf(`
data "ibm_org" "org" {
org = "%s"
}
data "ibm_account" "acc" {
org_guid = "${data.ibm_org.org.id}"
}
resource "ibm_container_cluster" "testacc_cluster" {
name = "%s"
datacenter = "%s"
account_guid = "${data.ibm_account.acc.id}"
worker_num = 1
machine_type = "%s"
hardware = "shared"
public_vlan_id = "%s"
private_vlan_id = "%s"
}
data "ibm_container_cluster" "testacc_ds_cluster" {
account_guid = "${data.ibm_account.acc.id}"
cluster_name_id = "${ibm_container_cluster.testacc_cluster.id}"
}
data "ibm_container_cluster_worker" "testacc_ds_worker" {
account_guid = "${data.ibm_account.acc.id}"
worker_id = "${data.ibm_container_cluster.testacc_ds_cluster.workers[0]}"
}
`, cfOrganization, clusterName, datacenter, machineType, publicVlanID, privateVlanID)
`, clusterName, datacenter, machineType, publicVlanID, privateVlanID)
}

func testAccCheckIBMContainerClusterWorkerDataSourceConfig(clusterName string) string {
Expand Down
2 changes: 1 addition & 1 deletion ibm/resource_ibm_container_bind_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func resourceIBMContainerBindService() *schema.Resource {
"account_guid": {
Description: "The bluemix account guid this cluster belongs to",
Type: schema.TypeString,
Required: true,
Optional: true,
ForceNew: true,
},
"tags": {
Expand Down
13 changes: 1 addition & 12 deletions ibm/resource_ibm_container_bind_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,15 @@ func TestAccIBMContainerBindService_WithoutOptionalFields(t *testing.T) {

func testAccCheckIBMContainerBindService_WithoutOptionalFields(clusterName, serviceName, serviceKey string) string {
return fmt.Sprintf(`
data "ibm_org" "org" {
org = "%s"
}
data "ibm_space" "space" {
org = "%s"
space = "%s"
}
data "ibm_account" "acc" {
org_guid = "${data.ibm_org.org.id}"
}
resource "ibm_container_cluster" "testacc_cluster" {
name = "%s"
datacenter = "%s"
org_guid = "${data.ibm_org.org.id}"
space_guid = "${data.ibm_space.space.id}"
account_guid = "${data.ibm_account.acc.id}"
worker_num = 1
machine_type = "%s"
Expand All @@ -116,9 +106,8 @@ resource "ibm_container_bind_service" "bind_service" {
cluster_name_id = "${ibm_container_cluster.testacc_cluster.name}"
service_instance_id = "${ibm_service_instance.service.id}"
namespace_id = "default"
account_guid = "${data.ibm_account.acc.id}"
}
`, cfOrganization, cfOrganization, cfSpace, clusterName, datacenter, machineType, publicVlanID, privateVlanID, serviceName, serviceKey)
`, cfOrganization, cfSpace, clusterName, datacenter, machineType, publicVlanID, privateVlanID, serviceName, serviceKey)
}

func testAccCheckIBMContainerBindService_basic(clusterName, serviceName, serviceKey string) string {
Expand Down
2 changes: 1 addition & 1 deletion ibm/resource_ibm_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func resourceIBMContainerCluster() *schema.Resource {
"account_guid": {
Description: "The bluemix account guid this cluster belongs to",
Type: schema.TypeString,
Required: true,
Optional: true,
ForceNew: true,
},
"wait_time_minutes": {
Expand Down
12 changes: 1 addition & 11 deletions ibm/resource_ibm_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,20 +540,10 @@ resource "ibm_container_cluster" "testacc_cluster" {
func testAccCheckIBMContainerClusterOptionalOrgSpace_basic(clusterName string) string {
return fmt.Sprintf(`
data "ibm_org" "org" {
org = "%s"
}
data "ibm_account" "acc" {
org_guid = "${data.ibm_org.org.id}"
}
resource "ibm_container_cluster" "testacc_cluster" {
name = "%s"
datacenter = "%s"
account_guid = "${data.ibm_account.acc.id}"
worker_num = 2
machine_type = "%s"
Expand All @@ -562,7 +552,7 @@ resource "ibm_container_cluster" "testacc_cluster" {
private_vlan_id = "%s"
no_subnet = true
disk_encryption = true
} `, cfOrganization, clusterName, datacenter, machineType, publicVlanID, privateVlanID)
} `, clusterName, datacenter, machineType, publicVlanID, privateVlanID)
}

func testAccCheckIBMContainerCluster_diskEnc(clusterName string) string {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions vendor/github.com/IBM-Cloud/bluemix-go/endpoints/endpoints.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b1ef55a

Please sign in to comment.