-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Remove force replacement from gcfs_config
- Loading branch information
1 parent
e30f86c
commit 7520262
Showing
6 changed files
with
95 additions
and
66 deletions.
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
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
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 |
---|---|---|
|
@@ -1736,7 +1736,23 @@ func TestAccContainerNodePool_gcfsConfig(t *testing.T) { | |
CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccContainerNodePool_gcfsConfig(cluster, np, networkName, subnetworkName), | ||
Config: testAccContainerNodePool_gcfsConfig(cluster, np, networkName, subnetworkName, true), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("google_container_node_pool.np", | ||
"node_config.0.gcfs_config.0.enabled", "true"), | ||
), | ||
}, | ||
{ | ||
ResourceName: "google_container_node_pool.np", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
{ | ||
Config: testAccContainerNodePool_gcfsConfig(cluster, np, networkName, subnetworkName, false), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("google_container_node_pool.np", | ||
"node_config.0.gcfs_config.0.enabled", "false"), | ||
), | ||
}, | ||
{ | ||
ResourceName: "google_container_node_pool.np", | ||
|
@@ -1747,7 +1763,7 @@ func TestAccContainerNodePool_gcfsConfig(t *testing.T) { | |
}) | ||
} | ||
|
||
func testAccContainerNodePool_gcfsConfig(cluster, np, networkName, subnetworkName string) string { | ||
func testAccContainerNodePool_gcfsConfig(cluster, np, networkName, subnetworkName string, enabled bool) string { | ||
return fmt.Sprintf(` | ||
resource "google_container_cluster" "cluster" { | ||
name = "%s" | ||
|
@@ -1768,11 +1784,11 @@ resource "google_container_node_pool" "np" { | |
machine_type = "n1-standard-8" | ||
image_type = "COS_CONTAINERD" | ||
gcfs_config { | ||
enabled = true | ||
enabled = %t | ||
} | ||
} | ||
} | ||
`, cluster, networkName, subnetworkName, np) | ||
`, cluster, networkName, subnetworkName, np, enabled) | ||
} | ||
|
||
func TestAccContainerNodePool_gvnic(t *testing.T) { | ||
|
@@ -4803,30 +4819,30 @@ func TestAccContainerNodePool_privateRegistry(t *testing.T) { | |
|
||
func testAccContainerNodePool_privateRegistryEnabled(secretID, cluster, nodepool, network, subnetwork string) string { | ||
return fmt.Sprintf(` | ||
data "google_project" "test_project" { | ||
data "google_project" "test_project" { | ||
} | ||
|
||
resource "google_secret_manager_secret" "secret-basic" { | ||
secret_id = "%s" | ||
replication { | ||
user_managed { | ||
replicas { | ||
location = "us-central1" | ||
} | ||
} | ||
} | ||
} | ||
|
||
resource "google_secret_manager_secret_version" "secret-version-basic" { | ||
secret = google_secret_manager_secret.secret-basic.id | ||
secret_data = "dummypassword" | ||
} | ||
resource "google_secret_manager_secret_iam_member" "secret_iam" { | ||
secret_id = google_secret_manager_secret.secret-basic.id | ||
role = "roles/secretmanager.admin" | ||
member = "serviceAccount:${data.google_project.test_project.number}[email protected]" | ||
depends_on = [google_secret_manager_secret_version.secret-version-basic] | ||
resource "google_secret_manager_secret" "secret-basic" { | ||
secret_id = "%s" | ||
replication { | ||
user_managed { | ||
replicas { | ||
location = "us-central1" | ||
} | ||
} | ||
} | ||
} | ||
|
||
resource "google_secret_manager_secret_version" "secret-version-basic" { | ||
secret = google_secret_manager_secret.secret-basic.id | ||
secret_data = "dummypassword" | ||
} | ||
|
||
resource "google_secret_manager_secret_iam_member" "secret_iam" { | ||
secret_id = google_secret_manager_secret.secret-basic.id | ||
role = "roles/secretmanager.admin" | ||
member = "serviceAccount:${data.google_project.test_project.number}[email protected]" | ||
depends_on = [google_secret_manager_secret_version.secret-version-basic] | ||
} | ||
|
||
resource "google_container_cluster" "cluster" { | ||
|
@@ -4837,13 +4853,13 @@ resource "google_container_cluster" "cluster" { | |
network = "%s" | ||
subnetwork = "%s" | ||
} | ||
|
||
resource "google_container_node_pool" "np" { | ||
name = "%s" | ||
location = "us-central1-a" | ||
cluster = google_container_cluster.cluster.name | ||
initial_node_count = 1 | ||
|
||
node_config { | ||
oauth_scopes = [ | ||
"https://www.googleapis.com/auth/cloud-platform", | ||
|
@@ -4931,4 +4947,4 @@ resource "google_container_node_pool" "np" { | |
} | ||
} | ||
`, cluster, np) | ||
} | ||
} |
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
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
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 |
---|---|---|
|
@@ -1719,7 +1719,23 @@ func TestAccContainerNodePool_gcfsConfig(t *testing.T) { | |
CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccContainerNodePool_gcfsConfig(cluster, np, networkName, subnetworkName), | ||
Config: testAccContainerNodePool_gcfsConfig(cluster, np, networkName, subnetworkName, true), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("google_container_node_pool.np", | ||
"node_config.0.gcfs_config.0.enabled", "true"), | ||
), | ||
}, | ||
{ | ||
ResourceName: "google_container_node_pool.np", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
{ | ||
Config: testAccContainerNodePool_gcfsConfig(cluster, np, networkName, subnetworkName, false), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("google_container_node_pool.np", | ||
"node_config.0.gcfs_config.0.enabled", "false"), | ||
), | ||
}, | ||
{ | ||
ResourceName: "google_container_node_pool.np", | ||
|
@@ -1730,7 +1746,7 @@ func TestAccContainerNodePool_gcfsConfig(t *testing.T) { | |
}) | ||
} | ||
|
||
func testAccContainerNodePool_gcfsConfig(cluster, np, networkName, subnetworkName string) string { | ||
func testAccContainerNodePool_gcfsConfig(cluster, np, networkName, subnetworkName string, enabled bool) string { | ||
return fmt.Sprintf(` | ||
resource "google_container_cluster" "cluster" { | ||
name = "%s" | ||
|
@@ -1751,11 +1767,11 @@ resource "google_container_node_pool" "np" { | |
machine_type = "n1-standard-8" | ||
image_type = "COS_CONTAINERD" | ||
gcfs_config { | ||
enabled = true | ||
enabled = %t | ||
} | ||
} | ||
} | ||
`, cluster, networkName, subnetworkName, np) | ||
`, cluster, networkName, subnetworkName, np, enabled) | ||
} | ||
|
||
func TestAccContainerNodePool_gvnic(t *testing.T) { | ||
|
@@ -4735,30 +4751,30 @@ func TestAccContainerNodePool_privateRegistry(t *testing.T) { | |
|
||
func testAccContainerNodePool_privateRegistryEnabled(secretID, cluster, nodepool, network, subnetwork string) string { | ||
return fmt.Sprintf(` | ||
data "google_project" "test_project" { | ||
data "google_project" "test_project" { | ||
} | ||
|
||
resource "google_secret_manager_secret" "secret-basic" { | ||
secret_id = "%s" | ||
replication { | ||
user_managed { | ||
replicas { | ||
location = "us-central1" | ||
} | ||
} | ||
} | ||
} | ||
|
||
resource "google_secret_manager_secret_version" "secret-version-basic" { | ||
secret = google_secret_manager_secret.secret-basic.id | ||
secret_data = "dummypassword" | ||
} | ||
resource "google_secret_manager_secret_iam_member" "secret_iam" { | ||
secret_id = google_secret_manager_secret.secret-basic.id | ||
role = "roles/secretmanager.admin" | ||
member = "serviceAccount:${data.google_project.test_project.number}[email protected]" | ||
depends_on = [google_secret_manager_secret_version.secret-version-basic] | ||
resource "google_secret_manager_secret" "secret-basic" { | ||
secret_id = "%s" | ||
replication { | ||
user_managed { | ||
replicas { | ||
location = "us-central1" | ||
} | ||
} | ||
} | ||
} | ||
|
||
resource "google_secret_manager_secret_version" "secret-version-basic" { | ||
secret = google_secret_manager_secret.secret-basic.id | ||
secret_data = "dummypassword" | ||
} | ||
|
||
resource "google_secret_manager_secret_iam_member" "secret_iam" { | ||
secret_id = google_secret_manager_secret.secret-basic.id | ||
role = "roles/secretmanager.admin" | ||
member = "serviceAccount:${data.google_project.test_project.number}[email protected]" | ||
depends_on = [google_secret_manager_secret_version.secret-version-basic] | ||
} | ||
|
||
resource "google_container_cluster" "cluster" { | ||
|
@@ -4769,13 +4785,13 @@ resource "google_container_cluster" "cluster" { | |
network = "%s" | ||
subnetwork = "%s" | ||
} | ||
|
||
resource "google_container_node_pool" "np" { | ||
name = "%s" | ||
location = "us-central1-a" | ||
cluster = google_container_cluster.cluster.name | ||
initial_node_count = 1 | ||
|
||
node_config { | ||
oauth_scopes = [ | ||
"https://www.googleapis.com/auth/cloud-platform", | ||
|