Skip to content

Commit

Permalink
make monitoring_config enable_components optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Sun committed Jul 10, 2023
1 parent 5405da5 commit d6ad9ec
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ func ResourceContainerCluster() *schema.Resource {
Schema: map[string]*schema.Schema{
"enable_components": {
Type: schema.TypeList,
Required: true,
Optional: true,
Description: `GKE components exposing logs. Valid values include SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, SCHEDULER, and WORKLOADS.`,
Elem: &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -1127,12 +1127,11 @@ func ResourceContainerCluster() *schema.Resource {
Schema: map[string]*schema.Schema{
"enable_components": {
Type: schema.TypeList,
Optional: true,
Computed: true,
<% if version == "ga" -%>
Required: true,
Description: `GKE components exposing metrics. Valid values include SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, and SCHEDULER.`,
<% else -%>
Optional: true,
Computed: true,
Description: `GKE components exposing metrics. Valid values include SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, SCHEDULER, and WORKLOADS.`,
<% end -%>
Elem: &schema.Schema{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2693,6 +2693,15 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
{
Config: testAccContainerCluster_withMonitoringConfigPrometheusOnly2(clusterName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
{
Config: testAccContainerCluster_basic(clusterName),
},
Expand Down Expand Up @@ -7451,6 +7460,20 @@ resource "google_container_cluster" "primary" {
`, name)
}

func testAccContainerCluster_withMonitoringConfigPrometheusOnly2(name string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1-a"
initial_node_count = 1
monitoring_config {
managed_prometheus {
enabled = true
}
}
}
`, name)
}

func testAccContainerCluster_withSoleTenantGroup(name string) string {
return fmt.Sprintf(`
Expand Down

0 comments on commit d6ad9ec

Please sign in to comment.