From 7b8d68065c9b34e842bf5b2820b286198ac85285 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 1 Oct 2021 15:28:38 -0700 Subject: [PATCH] Deprecate the Runtime Configurator service in the GA provider (#5267) (#10232) Signed-off-by: Modular Magician --- .changelog/5267.txt | 3 ++ google/data_source_runtimeconfig_config.go | 5 ++- google/iam.go | 14 +++++++ google/provider.go | 6 +-- google/resource_iam_binding.go | 16 ++++++-- google/resource_iam_member.go | 16 ++++++-- google/resource_iam_policy.go | 11 ++++- .../docs/d/runtimeconfig_config.html.markdown | 3 ++ .../guides/version_4_upgrade.html.markdown | 40 ++++++++++++++++++- .../docs/r/runtimeconfig_config.html.markdown | 2 + .../r/runtimeconfig_variable.html.markdown | 2 + 11 files changed, 104 insertions(+), 14 deletions(-) create mode 100644 .changelog/5267.txt diff --git a/.changelog/5267.txt b/.changelog/5267.txt new file mode 100644 index 00000000000..3670dfdcfaa --- /dev/null +++ b/.changelog/5267.txt @@ -0,0 +1,3 @@ +```release-note:deprecation +runtimeconfig: deprecated the Runtime Configurator service in 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 will only be available in the `google-beta` provider in a future release, as the underlying service is in beta. +``` diff --git a/google/data_source_runtimeconfig_config.go b/google/data_source_runtimeconfig_config.go index 41066a26a5f..8a1a4aa45fc 100644 --- a/google/data_source_runtimeconfig_config.go +++ b/google/data_source_runtimeconfig_config.go @@ -13,8 +13,9 @@ func dataSourceGoogleRuntimeconfigConfig() *schema.Resource { addOptionalFieldsToSchema(dsSchema, "project") return &schema.Resource{ - Read: dataSourceGoogleRuntimeconfigConfigRead, - Schema: dsSchema, + 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.", } } diff --git a/google/iam.go b/google/iam.go index e9d398b4589..7f953bf983f 100644 --- a/google/iam.go +++ b/google/iam.go @@ -448,3 +448,17 @@ func compareAuditConfigs(a, b []*cloudresourcemanager.AuditConfig) bool { bMap := createIamAuditConfigsMap(b) return reflect.DeepEqual(aMap, bMap) } + +type IamSettings struct { + DeprecationMessage string +} + +func IamWithDeprecationMessage(message string) func(s *IamSettings) { + return func(s *IamSettings) { + s.DeprecationMessage = message + } +} + +func IamWithGAResourceDeprecation() func(s *IamSettings) { + return IamWithDeprecationMessage("This resource has been deprecated in the google (GA) provider, and will only be available in the google-beta provider in a future release.") +} diff --git a/google/provider.go b/google/provider.go index c62c16d2afc..279d0e5942c 100644 --- a/google/provider.go +++ b/google/provider.go @@ -1087,9 +1087,9 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) { "google_pubsub_lite_subscription": resourcePubsubLiteSubscription(), "google_redis_instance": resourceRedisInstance(), "google_resource_manager_lien": resourceResourceManagerLien(), - "google_runtimeconfig_config_iam_binding": ResourceIamBinding(RuntimeConfigConfigIamSchema, RuntimeConfigConfigIamUpdaterProducer, RuntimeConfigConfigIdParseFunc), - "google_runtimeconfig_config_iam_member": ResourceIamMember(RuntimeConfigConfigIamSchema, RuntimeConfigConfigIamUpdaterProducer, RuntimeConfigConfigIdParseFunc), - "google_runtimeconfig_config_iam_policy": ResourceIamPolicy(RuntimeConfigConfigIamSchema, RuntimeConfigConfigIamUpdaterProducer, RuntimeConfigConfigIdParseFunc), + "google_runtimeconfig_config_iam_binding": ResourceIamBinding(RuntimeConfigConfigIamSchema, RuntimeConfigConfigIamUpdaterProducer, RuntimeConfigConfigIdParseFunc, IamWithGAResourceDeprecation()), + "google_runtimeconfig_config_iam_member": ResourceIamMember(RuntimeConfigConfigIamSchema, RuntimeConfigConfigIamUpdaterProducer, RuntimeConfigConfigIdParseFunc, IamWithGAResourceDeprecation()), + "google_runtimeconfig_config_iam_policy": ResourceIamPolicy(RuntimeConfigConfigIamSchema, RuntimeConfigConfigIamUpdaterProducer, RuntimeConfigConfigIdParseFunc, IamWithGAResourceDeprecation()), "google_secret_manager_secret": resourceSecretManagerSecret(), "google_secret_manager_secret_iam_binding": ResourceIamBinding(SecretManagerSecretIamSchema, SecretManagerSecretIamUpdaterProducer, SecretManagerSecretIdParseFunc), "google_secret_manager_secret_iam_member": ResourceIamMember(SecretManagerSecretIamSchema, SecretManagerSecretIamUpdaterProducer, SecretManagerSecretIdParseFunc), diff --git a/google/resource_iam_binding.go b/google/resource_iam_binding.go index 69a7652404b..2f6898eea43 100644 --- a/google/resource_iam_binding.go +++ b/google/resource_iam_binding.go @@ -62,17 +62,27 @@ var iamBindingSchema = map[string]*schema.Schema{ }, } -func ResourceIamBinding(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc newResourceIamUpdaterFunc, resourceIdParser resourceIdParserFunc) *schema.Resource { - return ResourceIamBindingWithBatching(parentSpecificSchema, newUpdaterFunc, resourceIdParser, IamBatchingDisabled) +func ResourceIamBinding(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc newResourceIamUpdaterFunc, resourceIdParser resourceIdParserFunc, options ...func(*IamSettings)) *schema.Resource { + return ResourceIamBindingWithBatching(parentSpecificSchema, newUpdaterFunc, resourceIdParser, IamBatchingDisabled, options...) } // Resource that batches requests to the same IAM policy across multiple IAM fine-grained resources -func ResourceIamBindingWithBatching(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc newResourceIamUpdaterFunc, resourceIdParser resourceIdParserFunc, enableBatching bool) *schema.Resource { +func ResourceIamBindingWithBatching(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc newResourceIamUpdaterFunc, resourceIdParser resourceIdParserFunc, enableBatching bool, options ...func(*IamSettings)) *schema.Resource { + settings := &IamSettings{} + for _, o := range options { + o(settings) + } + return &schema.Resource{ Create: resourceIamBindingCreateUpdate(newUpdaterFunc, enableBatching), Read: resourceIamBindingRead(newUpdaterFunc), Update: resourceIamBindingCreateUpdate(newUpdaterFunc, enableBatching), Delete: resourceIamBindingDelete(newUpdaterFunc, enableBatching), + + // if non-empty, this will be used to send a deprecation message when the + // resource is used. + DeprecationMessage: settings.DeprecationMessage, + Schema: mergeSchemas(iamBindingSchema, parentSpecificSchema), Importer: &schema.ResourceImporter{ State: iamBindingImport(newUpdaterFunc, resourceIdParser), diff --git a/google/resource_iam_member.go b/google/resource_iam_member.go index 3432c736600..604c210d3b9 100644 --- a/google/resource_iam_member.go +++ b/google/resource_iam_member.go @@ -147,15 +147,25 @@ func iamMemberImport(newUpdaterFunc newResourceIamUpdaterFunc, resourceIdParser } } -func ResourceIamMember(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc newResourceIamUpdaterFunc, resourceIdParser resourceIdParserFunc) *schema.Resource { - return ResourceIamMemberWithBatching(parentSpecificSchema, newUpdaterFunc, resourceIdParser, IamBatchingDisabled) +func ResourceIamMember(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc newResourceIamUpdaterFunc, resourceIdParser resourceIdParserFunc, options ...func(*IamSettings)) *schema.Resource { + return ResourceIamMemberWithBatching(parentSpecificSchema, newUpdaterFunc, resourceIdParser, IamBatchingDisabled, options...) } -func ResourceIamMemberWithBatching(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc newResourceIamUpdaterFunc, resourceIdParser resourceIdParserFunc, enableBatching bool) *schema.Resource { +func ResourceIamMemberWithBatching(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc newResourceIamUpdaterFunc, resourceIdParser resourceIdParserFunc, enableBatching bool, options ...func(*IamSettings)) *schema.Resource { + settings := &IamSettings{} + for _, o := range options { + o(settings) + } + return &schema.Resource{ Create: resourceIamMemberCreate(newUpdaterFunc, enableBatching), Read: resourceIamMemberRead(newUpdaterFunc), Delete: resourceIamMemberDelete(newUpdaterFunc, enableBatching), + + // if non-empty, this will be used to send a deprecation message when the + // resource is used. + DeprecationMessage: settings.DeprecationMessage, + Schema: mergeSchemas(IamMemberBaseSchema, parentSpecificSchema), Importer: &schema.ResourceImporter{ State: iamMemberImport(newUpdaterFunc, resourceIdParser), diff --git a/google/resource_iam_policy.go b/google/resource_iam_policy.go index a929313967d..d5f7164a8b4 100644 --- a/google/resource_iam_policy.go +++ b/google/resource_iam_policy.go @@ -37,13 +37,22 @@ func iamPolicyImport(resourceIdParser resourceIdParserFunc) schema.StateFunc { } } -func ResourceIamPolicy(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc newResourceIamUpdaterFunc, resourceIdParser resourceIdParserFunc) *schema.Resource { +func ResourceIamPolicy(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc newResourceIamUpdaterFunc, resourceIdParser resourceIdParserFunc, options ...func(*IamSettings)) *schema.Resource { + settings := &IamSettings{} + for _, o := range options { + o(settings) + } + return &schema.Resource{ Create: ResourceIamPolicyCreate(newUpdaterFunc), Read: ResourceIamPolicyRead(newUpdaterFunc), Update: ResourceIamPolicyUpdate(newUpdaterFunc), Delete: ResourceIamPolicyDelete(newUpdaterFunc), + // if non-empty, this will be used to send a deprecation message when the + // resource is used. + DeprecationMessage: settings.DeprecationMessage, + Schema: mergeSchemas(IamPolicyBaseSchema, parentSpecificSchema), Importer: &schema.ResourceImporter{ State: iamPolicyImport(resourceIdParser), diff --git a/website/docs/d/runtimeconfig_config.html.markdown b/website/docs/d/runtimeconfig_config.html.markdown index a1a5c10e498..0c132eeb4ce 100644 --- a/website/docs/d/runtimeconfig_config.html.markdown +++ b/website/docs/d/runtimeconfig_config.html.markdown @@ -11,6 +11,9 @@ description: |- To get more information about RuntimeConfigs, see: + +!> This datasource has been deprecated in the google (GA) provider, and will only be available in the google-beta provider in a future release. + * [API documentation](https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs) * How-to Guides * [Runtime Configurator Fundamentals](https://cloud.google.com/deployment-manager/runtime-configurator/) diff --git a/website/docs/guides/version_4_upgrade.html.markdown b/website/docs/guides/version_4_upgrade.html.markdown index c6abde1d48e..052a7612812 100644 --- a/website/docs/guides/version_4_upgrade.html.markdown +++ b/website/docs/guides/version_4_upgrade.html.markdown @@ -106,9 +106,45 @@ terraform { ## Provider -### Provider-level change example +### Runtime Configurator (`runtimeconfig`) resources have been removed from the GA provider + +Earlier versions of the provider accidentally included the Runtime Configurator +service at GA. `4.0.0` has corrected that error, and Runtime Configurator is +only available in `google-beta`. + +Affected Resources: + + * `google_runtimeconfig_config` + * `google_runtimeconfig_variable` + * `google_runtimeconfig_config_iam_policy` + * `google_runtimeconfig_config_iam_binding` + * `google_runtimeconfig_config_iam_member` + +Affected Datasources: + + * `google_runtimeconfig_config` + + +If you have a configuration using the `google` provider like the following: + +``` +resource "google_runtimeconfig_config" "my-runtime-config" { + name = "my-service-runtime-config" + description = "Runtime configuration values for my service" +} +``` + +Add the `google-beta` provider to your configuration: + +``` +resource "google_runtimeconfig_config" "my-runtime-config" { + provider = google-beta + + name = "my-service-runtime-config" + description = "Runtime configuration values for my service" +} +``` -Description of the change and how users should adjust their configuration (if needed). ## Datasource: `google_product_resource` diff --git a/website/docs/r/runtimeconfig_config.html.markdown b/website/docs/r/runtimeconfig_config.html.markdown index 73b08459ebd..af9055be0c1 100644 --- a/website/docs/r/runtimeconfig_config.html.markdown +++ b/website/docs/r/runtimeconfig_config.html.markdown @@ -11,6 +11,8 @@ description: |- Manages a RuntimeConfig resource in Google Cloud. +!> This resource has been deprecated in the google (GA) provider, and will only be available in the google-beta provider in a future release. + To get more information about RuntimeConfigs, see: * [API documentation](https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs) diff --git a/website/docs/r/runtimeconfig_variable.html.markdown b/website/docs/r/runtimeconfig_variable.html.markdown index 647897837c7..1f9b774c4bc 100644 --- a/website/docs/r/runtimeconfig_variable.html.markdown +++ b/website/docs/r/runtimeconfig_variable.html.markdown @@ -14,6 +14,8 @@ Manages a RuntimeConfig variable in Google Cloud. For more information, see the or the [JSON API](https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/). +!> This resource has been deprecated in the google (GA) provider, and will only be available in the google-beta provider in a future release. + ## Example Usage Example creating a RuntimeConfig variable.