mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-03 01:01:06 +00:00
convert dataproc_cluster.cluster_config.gce_cluster_config.tags into a set (#2633)
This commit is contained in:
parent
e31696da5a
commit
99f9d71a31
@ -144,7 +144,7 @@ func resourceDataprocCluster() *schema.Resource {
|
||||
},
|
||||
|
||||
"tags": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
Elem: &schema.Schema{Type: schema.TypeString},
|
||||
@ -541,7 +541,7 @@ func expandGceClusterConfig(d *schema.ResourceData, config *Config) (*dataproc.G
|
||||
conf.SubnetworkUri = snf.RelativeLink()
|
||||
}
|
||||
if v, ok := cfg["tags"]; ok {
|
||||
conf.Tags = convertStringArr(v.([]interface{}))
|
||||
conf.Tags = convertStringSet(v.(*schema.Set))
|
||||
}
|
||||
if v, ok := cfg["service_account"]; ok {
|
||||
conf.ServiceAccount = v.(string)
|
||||
@ -840,7 +840,7 @@ func flattenInitializationActions(nia []*dataproc.NodeInitializationAction) ([]m
|
||||
func flattenGceClusterConfig(d *schema.ResourceData, gcc *dataproc.GceClusterConfig) []map[string]interface{} {
|
||||
|
||||
gceConfig := map[string]interface{}{
|
||||
"tags": gcc.Tags,
|
||||
"tags": schema.NewSet(schema.HashString, convertStringArrToInterface(gcc.Tags)),
|
||||
"service_account": gcc.ServiceAccount,
|
||||
"zone": GetResourceNameFromSelfLink(gcc.ZoneUri),
|
||||
"internal_ip_only": gcc.InternalIpOnly,
|
||||
|
@ -217,7 +217,7 @@ func TestAccDataprocCluster_withInternalIpOnlyTrue(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccDataprocCluster_withMetadata(t *testing.T) {
|
||||
func TestAccDataprocCluster_withMetadataAndTags(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var cluster dataproc.Cluster
|
||||
@ -228,12 +228,13 @@ func TestAccDataprocCluster_withMetadata(t *testing.T) {
|
||||
CheckDestroy: testAccCheckDataprocClusterDestroy(),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccDataprocCluster_withMetadata(rnd),
|
||||
Config: testAccDataprocCluster_withMetadataAndTags(rnd),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckDataprocClusterExists("google_dataproc_cluster.basic", &cluster),
|
||||
|
||||
resource.TestCheckResourceAttr("google_dataproc_cluster.basic", "cluster_config.0.gce_cluster_config.0.metadata.foo", "bar"),
|
||||
resource.TestCheckResourceAttr("google_dataproc_cluster.basic", "cluster_config.0.gce_cluster_config.0.metadata.baz", "qux"),
|
||||
resource.TestCheckResourceAttr("google_dataproc_cluster.basic", "cluster_config.0.gce_cluster_config.0.tags.#", "4"),
|
||||
),
|
||||
},
|
||||
},
|
||||
@ -785,7 +786,7 @@ resource "google_dataproc_cluster" "basic" {
|
||||
`, rnd, rnd, rnd)
|
||||
}
|
||||
|
||||
func testAccDataprocCluster_withMetadata(rnd string) string {
|
||||
func testAccDataprocCluster_withMetadataAndTags(rnd string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_dataproc_cluster" "basic" {
|
||||
name = "dproc-cluster-test-%s"
|
||||
@ -797,6 +798,7 @@ resource "google_dataproc_cluster" "basic" {
|
||||
foo = "bar"
|
||||
baz = "qux"
|
||||
}
|
||||
tags = ["my-tag", "your-tag", "our-tag", "their-tag"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user