Skip to content

Commit 1285699

Browse files
Add FirebaseRules resources (#5695) (#11297)
Signed-off-by: Modular Magician <[email protected]>
1 parent 10b9f40 commit 1285699

17 files changed

+1573
-16
lines changed

.changelog/5695.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```release-note:new-resource
2+
`google_firebaserules_ruleset`
3+
```
4+
```release-note:new-resource
5+
`google_firebaserules_release`
6+
```

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/hashicorp/terraform-provider-google
22
require (
33
cloud.google.com/go/bigtable v1.10.1
44
cloud.google.com/go/iam v0.1.1 // indirect
5-
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220310234957-05f157784867
5+
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220316014534-ac1c1c4fdb29
66
github.com/apparentlymart/go-cidr v1.1.0
77
github.com/client9/misspell v0.3.4
88
github.com/davecgh/go-spew v1.1.1

go.sum

+6-2
Original file line numberDiff line numberDiff line change
@@ -1533,5 +1533,9 @@ github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-202202
15331533
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220225200700-e76d50f1e637/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
15341534
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220304175357-35332d17a512 h1:8/Sn9pDdk/RxECtLUh4xum2eyUvf0h7bpx8h+lYvE+Q=
15351535
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220304175357-35332d17a512/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
1536-
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220310234957-05f157784867 h1:spnm9WU2KGFDrqgn0XL2d5H0oo7Lw0rvm/E8t1qWSdI=
1537-
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220310234957-05f157784867/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
1536+
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220304175357-35332d17a512 h1:8/Sn9pDdk/RxECtLUh4xum2eyUvf0h7bpx8h+lYvE+Q=
1537+
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220304175357-35332d17a512/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
1538+
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220316014534-ac1c1c4fdb29 h1:bxYB6H8CwwCyfT1QQqnsn3rmy+TNILPTdtH9IwrgsmE=
1539+
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220316014534-ac1c1c4fdb29/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
1540+
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220316014534-ac1c1c4fdb29 h1:bxYB6H8CwwCyfT1QQqnsn3rmy+TNILPTdtH9IwrgsmE=
1541+
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20220316014534-ac1c1c4fdb29/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=

google/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ type Config struct {
249249
ContainerAwsBasePath string
250250
ContainerAzureBasePath string
251251
EventarcBasePath string
252+
FirebaserulesBasePath string
252253
GkeHubBasePath string
253254
NetworkConnectivityBasePath string
254255
OrgPolicyBasePath string

google/provider.go

+4
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ func Provider() *schema.Provider {
695695
AssuredWorkloadsEndpointEntryKey: AssuredWorkloadsEndpointEntry,
696696
CloudResourceManagerEndpointEntryKey: CloudResourceManagerEndpointEntry,
697697
EventarcEndpointEntryKey: EventarcEndpointEntry,
698+
FirebaserulesEndpointEntryKey: FirebaserulesEndpointEntry,
698699
GkeHubFeatureCustomEndpointEntryKey: GkeHubFeatureCustomEndpointEntry,
699700
NetworkConnectivityEndpointEntryKey: NetworkConnectivityEndpointEntry,
700701
OrgPolicyEndpointEntryKey: OrgPolicyEndpointEntry,
@@ -1233,6 +1234,8 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
12331234
"google_container_azure_node_pool": resourceContainerAzureNodePool(),
12341235
"google_dataproc_workflow_template": resourceDataprocWorkflowTemplate(),
12351236
"google_eventarc_trigger": resourceEventarcTrigger(),
1237+
"google_firebaserules_release": resourceFirebaserulesRelease(),
1238+
"google_firebaserules_ruleset": resourceFirebaserulesRuleset(),
12361239
"google_logging_log_view": resourceLoggingLogView(),
12371240
"google_network_connectivity_hub": resourceNetworkConnectivityHub(),
12381241
"google_network_connectivity_spoke": resourceNetworkConnectivitySpoke(),
@@ -1473,6 +1476,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
14731476
config.AssuredWorkloadsBasePath = d.Get(AssuredWorkloadsEndpointEntryKey).(string)
14741477
config.CloudResourceManagerBasePath = d.Get(CloudResourceManagerEndpointEntryKey).(string)
14751478
config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
1479+
config.FirebaserulesBasePath = d.Get(FirebaserulesEndpointEntryKey).(string)
14761480
config.GkeHubBasePath = d.Get(GkeHubFeatureCustomEndpointEntryKey).(string)
14771481
config.NetworkConnectivityBasePath = d.Get(NetworkConnectivityEndpointEntryKey).(string)
14781482
config.OrgPolicyBasePath = d.Get(OrgPolicyEndpointEntryKey).(string)

google/provider_dcl_client_creation.go

+24
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
containerazure "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containerazure"
3030
dataproc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataproc"
3131
eventarc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/eventarc"
32+
firebaserules "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/firebaserules"
3233
logging "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/logging"
3334
networkconnectivity "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/networkconnectivity"
3435
orgpolicy "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/orgpolicy"
@@ -267,6 +268,29 @@ func NewDCLEventarcClient(config *Config, userAgent, billingProject string, time
267268
return eventarc.NewClient(dclConfig)
268269
}
269270

271+
func NewDCLFirebaserulesClient(config *Config, userAgent, billingProject string, timeout time.Duration) *firebaserules.Client {
272+
configOptions := []dcl.ConfigOption{
273+
dcl.WithHTTPClient(config.client),
274+
dcl.WithUserAgent(userAgent),
275+
dcl.WithLogger(dclLogger{}),
276+
dcl.WithBasePath(config.FirebaserulesBasePath),
277+
}
278+
279+
if timeout != 0 {
280+
configOptions = append(configOptions, dcl.WithTimeout(timeout))
281+
}
282+
283+
if config.UserProjectOverride {
284+
configOptions = append(configOptions, dcl.WithUserProjectOverride())
285+
if billingProject != "" {
286+
configOptions = append(configOptions, dcl.WithBillingProject(billingProject))
287+
}
288+
}
289+
290+
dclConfig := dcl.NewConfig(configOptions...)
291+
return firebaserules.NewClient(dclConfig)
292+
}
293+
270294
func NewDCLLoggingClient(config *Config, userAgent, billingProject string, timeout time.Duration) *logging.Client {
271295
configOptions := []dcl.ConfigOption{
272296
dcl.WithHTTPClient(config.client),

google/provider_dcl_endpoints.go

+12
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ var EventarcEndpointEntry = &schema.Schema{
9494
}, ""),
9595
}
9696

97+
var FirebaserulesEndpointEntryKey = "firebaserules_custom_endpoint"
98+
var FirebaserulesEndpointEntry = &schema.Schema{
99+
Type: schema.TypeString,
100+
Optional: true,
101+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
102+
"GOOGLE_FIREBASERULES_CUSTOM_ENDPOINT",
103+
}, ""),
104+
}
105+
97106
var LoggingEndpointEntryKey = "logging_custom_endpoint"
98107
var LoggingEndpointEntry = &schema.Schema{
99108
Type: schema.TypeString,
@@ -157,6 +166,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
157166
//ContainerAwsBasePath string
158167
//ContainerAzureBasePath string
159168
//EventarcBasePath string
169+
//FirebaserulesBasePath string
160170
//LoggingBasePath string
161171
//NetworkConnectivityBasePath string
162172
//OrgPolicyBasePath string
@@ -173,6 +183,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
173183
// ContainerAwsEndpointEntryKey: ContainerAwsEndpointEntry,
174184
// ContainerAzureEndpointEntryKey: ContainerAzureEndpointEntry,
175185
// EventarcEndpointEntryKey: EventarcEndpointEntry,
186+
// FirebaserulesEndpointEntryKey: FirebaserulesEndpointEntry,
176187
// LoggingEndpointEntryKey: LoggingEndpointEntry,
177188
// NetworkConnectivityEndpointEntryKey: NetworkConnectivityEndpointEntry,
178189
// OrgPolicyEndpointEntryKey: OrgPolicyEndpointEntry,
@@ -189,6 +200,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
189200
// config.ContainerAwsBasePath = d.Get(ContainerAwsEndpointEntryKey).(string)
190201
// config.ContainerAzureBasePath = d.Get(ContainerAzureEndpointEntryKey).(string)
191202
// config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
203+
// config.FirebaserulesBasePath = d.Get(FirebaserulesEndpointEntryKey).(string)
192204
// config.LoggingBasePath = d.Get(LoggingEndpointEntryKey).(string)
193205
// config.NetworkConnectivityBasePath = d.Get(NetworkConnectivityEndpointEntryKey).(string)
194206
// config.OrgPolicyBasePath = d.Get(OrgPolicyEndpointEntryKey).(string)

google/resource_container_aws_node_pool.go

-13
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ func resourceContainerAwsNodePool() *schema.Resource {
4848
"autoscaling": {
4949
Type: schema.TypeList,
5050
Required: true,
51-
ForceNew: true,
5251
Description: "Required. Autoscaler configuration for this node pool.",
5352
MaxItems: 1,
5453
Elem: ContainerAwsNodePoolAutoscalingSchema(),
@@ -65,7 +64,6 @@ func resourceContainerAwsNodePool() *schema.Resource {
6564
"config": {
6665
Type: schema.TypeList,
6766
Required: true,
68-
ForceNew: true,
6967
Description: "Required. The configuration of the node pool.",
7068
MaxItems: 1,
7169
Elem: ContainerAwsNodePoolConfigSchema(),
@@ -104,7 +102,6 @@ func resourceContainerAwsNodePool() *schema.Resource {
104102
"version": {
105103
Type: schema.TypeString,
106104
Required: true,
107-
ForceNew: true,
108105
Description: "Required. The Kubernetes version to run on this node pool (e.g. `1.19.10-gke.1000`). You can list all supported versions on a given Google Cloud region by calling GetAwsServerConfig.",
109106
},
110107

@@ -169,14 +166,12 @@ func ContainerAwsNodePoolAutoscalingSchema() *schema.Resource {
169166
"max_node_count": {
170167
Type: schema.TypeInt,
171168
Required: true,
172-
ForceNew: true,
173169
Description: "Required. Maximum number of nodes in the NodePool. Must be >= min_node_count.",
174170
},
175171

176172
"min_node_count": {
177173
Type: schema.TypeInt,
178174
Required: true,
179-
ForceNew: true,
180175
Description: "Required. Minimum number of nodes in the NodePool. Must be >= 1 and <= max_node_count.",
181176
},
182177
},
@@ -189,7 +184,6 @@ func ContainerAwsNodePoolConfigSchema() *schema.Resource {
189184
"config_encryption": {
190185
Type: schema.TypeList,
191186
Required: true,
192-
ForceNew: true,
193187
Description: "Required. The ARN of the AWS KMS key used to encrypt node pool configuration.",
194188
MaxItems: 1,
195189
Elem: ContainerAwsNodePoolConfigConfigEncryptionSchema(),
@@ -222,7 +216,6 @@ func ContainerAwsNodePoolConfigSchema() *schema.Resource {
222216
Type: schema.TypeList,
223217
Computed: true,
224218
Optional: true,
225-
ForceNew: true,
226219
Description: "Optional. Template for the root volume provisioned for node pool nodes. Volumes will be provisioned in the availability zone assigned to the node pool subnet. When unspecified, it defaults to 32 GiB with the GP2 volume type.",
227220
MaxItems: 1,
228221
Elem: ContainerAwsNodePoolConfigRootVolumeSchema(),
@@ -231,7 +224,6 @@ func ContainerAwsNodePoolConfigSchema() *schema.Resource {
231224
"security_group_ids": {
232225
Type: schema.TypeList,
233226
Optional: true,
234-
ForceNew: true,
235227
Description: "Optional. The IDs of additional security groups to add to nodes in this pool. The manager will automatically create security groups with minimum rules needed for a functioning cluster.",
236228
Elem: &schema.Schema{Type: schema.TypeString},
237229
},
@@ -270,7 +262,6 @@ func ContainerAwsNodePoolConfigConfigEncryptionSchema() *schema.Resource {
270262
"kms_key_arn": {
271263
Type: schema.TypeString,
272264
Required: true,
273-
ForceNew: true,
274265
Description: "Required. The ARN of the AWS KMS key used to encrypt node pool configuration.",
275266
},
276267
},
@@ -284,30 +275,26 @@ func ContainerAwsNodePoolConfigRootVolumeSchema() *schema.Resource {
284275
Type: schema.TypeInt,
285276
Computed: true,
286277
Optional: true,
287-
ForceNew: true,
288278
Description: "Optional. The number of I/O operations per second (IOPS) to provision for GP3 volume.",
289279
},
290280

291281
"kms_key_arn": {
292282
Type: schema.TypeString,
293283
Optional: true,
294-
ForceNew: true,
295284
Description: "Optional. The Amazon Resource Name (ARN) of the Customer Managed Key (CMK) used to encrypt AWS EBS volumes. If not specified, the default Amazon managed key associated to the AWS region where this cluster runs will be used.",
296285
},
297286

298287
"size_gib": {
299288
Type: schema.TypeInt,
300289
Computed: true,
301290
Optional: true,
302-
ForceNew: true,
303291
Description: "Optional. The size of the volume, in GiBs. When unspecified, a default value is provided. See the specific reference in the parent resource.",
304292
},
305293

306294
"volume_type": {
307295
Type: schema.TypeString,
308296
Computed: true,
309297
Optional: true,
310-
ForceNew: true,
311298
Description: "Optional. Type of the EBS volume. When unspecified, it defaults to GP2 volume. Possible values: VOLUME_TYPE_UNSPECIFIED, GP2, GP3",
312299
},
313300
},

0 commit comments

Comments
 (0)