Skip to content

Commit

Permalink
Remove beta fields from the google provider (#5262) (#10410)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Oct 26, 2021
1 parent f5b90ee commit 65b7d99
Show file tree
Hide file tree
Showing 29 changed files with 48 additions and 1,614 deletions.
15 changes: 15 additions & 0 deletions .changelog/5262.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```release-note:breaking-change
compute: removed the `update_policy.min_ready_sec` field from `google_compute_instance_group_manager`, `google_compute_region_instance_group_manager` in the GA provider
```
```release-note:breaking-change
compute: removed the `enable_display` field from `google_compute_instance_template` in the GA provider
```
```release-note:breaking-change
container: removed the `pod_security_policy_config` field from `google_container_cluster` in the GA provider
```
```release-note:breaking-change
container: removed the `workload_identity_config.0.identity_namespace` field from `google_container_cluster`, use `workload_identity_config.0.workload_pool` instead
```
```release-note:breaking-change
runtimeconfig: removed the Runtime Configurator service from the `google` (GA) provider including `google_runtimeconfig_config`, `google_runtimeconfig_variable`, `google_runtimeconfig_config_iam_policy`, `google_runtimeconfig_config_iam_binding`, `google_runtimeconfig_config_iam_member`, `data.google_runtimeconfig_config`. They are only available in the `google-beta` provider, as the underlying service is in beta.
```
19 changes: 0 additions & 19 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (
iamcredentials "google.golang.org/api/iamcredentials/v1"
cloudlogging "google.golang.org/api/logging/v2"
"google.golang.org/api/pubsub/v1"
runtimeconfig "google.golang.org/api/runtimeconfig/v1beta1"
"google.golang.org/api/servicemanagement/v1"
"google.golang.org/api/servicenetworking/v1"
"google.golang.org/api/serviceusage/v1"
Expand Down Expand Up @@ -133,7 +132,6 @@ type Config struct {
PubsubLiteBasePath string
RedisBasePath string
ResourceManagerBasePath string
RuntimeConfigBasePath string
SecretManagerBasePath string
SecurityCenterBasePath string
ServiceManagementBasePath string
Expand Down Expand Up @@ -227,7 +225,6 @@ const PubsubBasePathKey = "Pubsub"
const PubsubLiteBasePathKey = "PubsubLite"
const RedisBasePathKey = "Redis"
const ResourceManagerBasePathKey = "ResourceManager"
const RuntimeConfigBasePathKey = "RuntimeConfig"
const SecretManagerBasePathKey = "SecretManager"
const SecurityCenterBasePathKey = "SecurityCenter"
const ServiceManagementBasePathKey = "ServiceManagement"
Expand Down Expand Up @@ -310,7 +307,6 @@ var DefaultBasePaths = map[string]string{
PubsubLiteBasePathKey: "https://{{region}}-pubsublite.googleapis.com/v1/admin/",
RedisBasePathKey: "https://redis.googleapis.com/v1/",
ResourceManagerBasePathKey: "https://cloudresourcemanager.googleapis.com/v1/",
RuntimeConfigBasePathKey: "https://runtimeconfig.googleapis.com/v1beta1/",
SecretManagerBasePathKey: "https://secretmanager.googleapis.com/v1/",
SecurityCenterBasePathKey: "https://securitycenter.googleapis.com/v1/",
ServiceManagementBasePathKey: "https://servicemanagement.googleapis.com/v1/",
Expand Down Expand Up @@ -721,20 +717,6 @@ func (c *Config) NewResourceManagerV2Client(userAgent string) *resourceManagerV2
return clientResourceManagerV2
}

func (c *Config) NewRuntimeconfigClient(userAgent string) *runtimeconfig.Service {
runtimeConfigClientBasePath := removeBasePathVersion(c.RuntimeConfigBasePath)
log.Printf("[INFO] Instantiating Google Cloud Runtimeconfig client for path %s", runtimeConfigClientBasePath)
clientRuntimeconfig, err := runtimeconfig.NewService(c.context, option.WithHTTPClient(c.client))
if err != nil {
log.Printf("[WARN] Error creating client runtime config: %s", err)
return nil
}
clientRuntimeconfig.UserAgent = userAgent
clientRuntimeconfig.BasePath = runtimeConfigClientBasePath

return clientRuntimeconfig
}

func (c *Config) NewIamClient(userAgent string) *iam.Service {
iamClientBasePath := removeBasePathVersion(c.IAMBasePath)
log.Printf("[INFO] Instantiating Google Cloud IAM client for path %s", iamClientBasePath)
Expand Down Expand Up @@ -1176,7 +1158,6 @@ func ConfigureBasePaths(c *Config) {
c.PubsubLiteBasePath = DefaultBasePaths[PubsubLiteBasePathKey]
c.RedisBasePath = DefaultBasePaths[RedisBasePathKey]
c.ResourceManagerBasePath = DefaultBasePaths[ResourceManagerBasePathKey]
c.RuntimeConfigBasePath = DefaultBasePaths[RuntimeConfigBasePathKey]
c.SecretManagerBasePath = DefaultBasePaths[SecretManagerBasePathKey]
c.SecurityCenterBasePath = DefaultBasePaths[SecurityCenterBasePathKey]
c.ServiceManagementBasePath = DefaultBasePaths[ServiceManagementBasePathKey]
Expand Down
30 changes: 0 additions & 30 deletions google/data_source_runtimeconfig_config.go
Original file line number Diff line number Diff line change
@@ -1,31 +1 @@
package google

import (
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceGoogleRuntimeconfigConfig() *schema.Resource {

dsSchema := datasourceSchemaFromResourceSchema(resourceRuntimeconfigConfig().Schema)
addRequiredFieldsToSchema(dsSchema, "name")
addOptionalFieldsToSchema(dsSchema, "project")

return &schema.Resource{
Read: dataSourceGoogleRuntimeconfigConfigRead,
Schema: dsSchema,
DeprecationMessage: "This datasource has been deprecated in the google (GA) provider, and will only be available in the google-beta provider in a future release.",
}
}

func dataSourceGoogleRuntimeconfigConfigRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)

id, err := replaceVars(d, config, "projects/{{project}}/configs/{{name}}")
if err != nil {
return fmt.Errorf("Error constructing id: %s", err)
}
d.SetId(id)
return resourceRuntimeconfigConfigRead(d, meta)
}
37 changes: 0 additions & 37 deletions google/data_source_runtimeconfig_config_test.go
Original file line number Diff line number Diff line change
@@ -1,38 +1 @@
package google

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccRuntimeconfigConfigDatasource_basic(t *testing.T) {
t.Parallel()

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccRuntimeconfigDatasourceConfig(randString(t, 10)),
Check: resource.ComposeTestCheckFunc(
checkDataSourceStateMatchesResourceState("data.google_runtimeconfig_config.default", "google_runtimeconfig_config.default"),
),
},
},
})
}

func testAccRuntimeconfigDatasourceConfig(suffix string) string {
return fmt.Sprintf(`
resource "google_runtimeconfig_config" "default" {
name = "runtime-%s"
description = "runtime-%s"
}
data "google_runtimeconfig_config" "default" {
name = google_runtimeconfig_config.default.name
}
`, suffix, suffix)
}
198 changes: 0 additions & 198 deletions google/iam_runtimeconfig_config.go

This file was deleted.

Loading

0 comments on commit 65b7d99

Please sign in to comment.