Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Check DeviceCheck provider #2027

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/hcl/v2 v2.19.1
github.com/hashicorp/terraform-json v0.18.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240307175818-46619b4dc885
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240307200055-472c6ace9574
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwU
github.com/hashicorp/terraform-plugin-mux v0.13.0 h1:79U401/3nd8CWwDGtTHc8F3miSCAS9XGtVarxSTDgwA=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0 h1:Bl3e2ei2j/Z3Hc2HIS15Gal2KMKyLAZ2om1HCEvK6es=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0/go.mod h1:i2C41tszDjiWfziPQDL5R/f3Zp0gahXe5No/MIO9rCE=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240307175818-46619b4dc885 h1:yVFG/vAVLm7/HLN7EHDZkvzLYCP7W8hIA8OuEd6Q4qk=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240307175818-46619b4dc885/go.mod h1:xqktgz44XcXx24WFlm6lYZEri5YeyyFGL+qBamSShDc=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240307200055-472c6ace9574 h1:n2FgZEbA+1reRzei47X1K0EqV6kJwDSJCg+EIfOS8vc=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240307200055-472c6ace9574/go.mod h1:xqktgz44XcXx24WFlm6lYZEri5YeyyFGL+qBamSShDc=
github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI=
github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM=
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** Type: MMv1 ***
//
// ----------------------------------------------------------------------------
//
// This file is automatically generated by Magic Modules and manual
// changes will be clobbered when the file is regenerated.
//
// Please read more about how to change this file in
// .github/CONTRIBUTING.md.
//
// ----------------------------------------------------------------------------

package firebaseappcheck

import (
"reflect"

"github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/cai"
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
)

const FirebaseAppCheckDeviceCheckConfigAssetType string = "firebaseappcheck.googleapis.com/DeviceCheckConfig"

func ResourceConverterFirebaseAppCheckDeviceCheckConfig() cai.ResourceConverter {
return cai.ResourceConverter{
AssetType: FirebaseAppCheckDeviceCheckConfigAssetType,
Convert: GetFirebaseAppCheckDeviceCheckConfigCaiObject,
}
}

func GetFirebaseAppCheckDeviceCheckConfigCaiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) ([]cai.Asset, error) {
name, err := cai.AssetName(d, config, "//firebaseappcheck.googleapis.com/projects/{{project}}/apps/{{app_id}}/deviceCheckConfig")
if err != nil {
return []cai.Asset{}, err
}
if obj, err := GetFirebaseAppCheckDeviceCheckConfigApiObject(d, config); err == nil {
return []cai.Asset{{
Name: name,
Type: FirebaseAppCheckDeviceCheckConfigAssetType,
Resource: &cai.AssetResource{
Version: "v1beta",
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/firebaseappcheck/v1beta/rest",
DiscoveryName: "DeviceCheckConfig",
Data: obj,
},
}}, nil
} else {
return []cai.Asset{}, err
}
}

func GetFirebaseAppCheckDeviceCheckConfigApiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]interface{}, error) {
obj := make(map[string]interface{})
tokenTtlProp, err := expandFirebaseAppCheckDeviceCheckConfigTokenTtl(d.Get("token_ttl"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("token_ttl"); !tpgresource.IsEmptyValue(reflect.ValueOf(tokenTtlProp)) && (ok || !reflect.DeepEqual(v, tokenTtlProp)) {
obj["tokenTtl"] = tokenTtlProp
}
keyIdProp, err := expandFirebaseAppCheckDeviceCheckConfigKeyId(d.Get("key_id"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("key_id"); !tpgresource.IsEmptyValue(reflect.ValueOf(keyIdProp)) && (ok || !reflect.DeepEqual(v, keyIdProp)) {
obj["keyId"] = keyIdProp
}
privateKeyProp, err := expandFirebaseAppCheckDeviceCheckConfigPrivateKey(d.Get("private_key"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("private_key"); !tpgresource.IsEmptyValue(reflect.ValueOf(privateKeyProp)) && (ok || !reflect.DeepEqual(v, privateKeyProp)) {
obj["privateKey"] = privateKeyProp
}

return obj, nil
}

func expandFirebaseAppCheckDeviceCheckConfigTokenTtl(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandFirebaseAppCheckDeviceCheckConfigKeyId(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandFirebaseAppCheckDeviceCheckConfigPrivateKey(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}