Skip to content

Commit

Permalink
Deprecate the Runtime Configurator service in the GA provider (#5267) (
Browse files Browse the repository at this point in the history
…#10232)

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Oct 1, 2021
1 parent 99dae61 commit 7b8d680
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .changelog/5267.txt
Original file line number Diff line number Diff line change
@@ -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.
```
5 changes: 3 additions & 2 deletions google/data_source_runtimeconfig_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
}
}

Expand Down
14 changes: 14 additions & 0 deletions google/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
6 changes: 3 additions & 3 deletions google/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
16 changes: 13 additions & 3 deletions google/resource_iam_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
16 changes: 13 additions & 3 deletions google/resource_iam_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
11 changes: 10 additions & 1 deletion google/resource_iam_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
3 changes: 3 additions & 0 deletions website/docs/d/runtimeconfig_config.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
40 changes: 38 additions & 2 deletions website/docs/guides/version_4_upgrade.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/runtimeconfig_config.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/runtimeconfig_variable.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7b8d680

Please sign in to comment.