-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CCE): import CCE resource, unit test and document.
- Loading branch information
1 parent
a42e5c6
commit d90049f
Showing
3 changed files
with
134 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
subcategory: "Cloud Container Engine (CCE)" | ||
--- | ||
|
||
# flexibleengine_cce_nodes | ||
|
||
Use this data source to get a list of CCE nodes. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
variable "cluster_id" {} | ||
variable "node_name" {} | ||
data "flexibleengine_cce_nodes" "node" { | ||
cluster_id = var.cluster_id | ||
name = var.node_name | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `region` - (Optional, String) Specifies the region in which to query the CCE nodes. If omitted, the provider-level | ||
region will be used. | ||
|
||
* `cluster_id` - (Required, String) Specifies the ID of CCE cluster. | ||
|
||
* `name` - (Optional, String) Specifies the of the node. | ||
|
||
* `node_id` - (Optional, String) Specifies the ID of the node. | ||
|
||
* `status` - (Optional, String) Specifies the status of the node. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - Indicates a data source ID. | ||
|
||
* `ids` - Indicates a list of IDs of all CCE nodes found. | ||
|
||
* `nodes` - Indicates a list of CCE nodes found. The [nodes](#cce_nodes) object structure is documented below. | ||
|
||
<a name="cce_nodes"></a> | ||
The `nodes` block supports: | ||
|
||
* `name` - The name of the node. | ||
|
||
* `id` - The ID of the node. | ||
|
||
* `status` - The state of the node. | ||
|
||
* `flavor_id` - The flavor ID to be used. | ||
|
||
* `availability_zone` - The available partitions where the node is located. | ||
|
||
* `os` - The operating System of the node. | ||
|
||
* `subnet_id` - The ID of the subnet to which the NIC belongs. | ||
|
||
* `ecs_group_id` - The ID of ECS group to which the node belongs. | ||
|
||
* `tags` - The tags of a VM node, key/value pair format. | ||
|
||
* `key_pair` - The key pair name when logging in to select the key pair mode. | ||
|
||
* `billing_mode` - The node's billing mode: The value is 0 (on demand). | ||
|
||
* `server_id` - The node's virtual machine ID in ECS. | ||
|
||
* `public_ip` - The elastic IP parameters of the node. | ||
|
||
* `private_ip` - The private IP of the node. | ||
|
||
* `root_volume` - The system disk related configuration. The [volume](#cce_volume) object structure is documented below. | ||
|
||
* `data_volumes` - The data related configuration. The [volume](#cce_volume) object structure is documented below. | ||
|
||
<a name="cce_volume"></a> | ||
The `root_volume` and `data_volumes` blocks support: | ||
|
||
* `size` - Disk size in GB. | ||
|
||
* `volumetype` - Disk type. | ||
|
||
* `extend_params` - Disk expansion parameters. |
43 changes: 43 additions & 0 deletions
43
flexibleengine/acceptance/data_source_flexibleengine_cce_nodes_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package acceptance | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccNodesDataSource_basic(t *testing.T) { | ||
dataSourceName := "data.flexibleengine_cce_nodes.test" | ||
dc := acceptance.InitDataSourceCheck(dataSourceName) | ||
rName := acceptance.RandomAccResourceNameWithDash() | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
ProviderFactories: TestAccProviderFactories, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccNodesDataSource_basic(rName), | ||
Check: resource.ComposeTestCheckFunc( | ||
dc.CheckResourceExists(), | ||
resource.TestCheckResourceAttr(dataSourceName, "nodes.0.name", rName), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccNodesDataSource_basic(rName string) string { | ||
return fmt.Sprintf(` | ||
%s | ||
data "flexibleengine_cce_nodes" "test" { | ||
cluster_id = flexibleengine_cce_cluster_v3.test.id | ||
name = flexibleengine_cce_node_v3.test.name | ||
depends_on = [flexibleengine_cce_node_v3.test] | ||
} | ||
`, testAccCceCluster_config(rName)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters