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

Added new resource "Project Cloud Armor Tier" #2340

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.21.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240604190142-b21c7ce8af1d
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240604210318-0b2a414427e8
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ github.com/hashicorp/terraform-plugin-mux v0.15.0 h1:+/+lDx0WUsIOpkAmdwBIoFU8UP9
github.com/hashicorp/terraform-plugin-mux v0.15.0/go.mod h1:9ezplb1Dyq394zQ+ldB0nvy/qbNAz3mMoHHseMTMaKo=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240604190142-b21c7ce8af1d h1:CCX8r+LrSMjtRedkL9W1/WnaktE4PQligjJzKxTjCQY=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240604190142-b21c7ce8af1d/go.mod h1:SNKv+hr6LzJeJpYa1rdCVdY0hSWc90Z57tPsiISEAlo=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240604210318-0b2a414427e8 h1:ZwOk0kbyB3Av5e/HcDPIPXgjTc+X0wwM3s9TaV2sV0E=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240604210318-0b2a414427e8/go.mod h1:SNKv+hr6LzJeJpYa1rdCVdY0hSWc90Z57tPsiISEAlo=
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,69 @@
// ----------------------------------------------------------------------------
//
// *** 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 compute

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 ComputeProjectCloudArmorTierAssetType string = "compute.googleapis.com/ProjectCloudArmorTier"

func ResourceConverterComputeProjectCloudArmorTier() cai.ResourceConverter {
return cai.ResourceConverter{
AssetType: ComputeProjectCloudArmorTierAssetType,
Convert: GetComputeProjectCloudArmorTierCaiObject,
}
}

func GetComputeProjectCloudArmorTierCaiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) ([]cai.Asset, error) {
name, err := cai.AssetName(d, config, "//compute.googleapis.com/projects/{{project}}/{{name}}")
if err != nil {
return []cai.Asset{}, err
}
if obj, err := GetComputeProjectCloudArmorTierApiObject(d, config); err == nil {
return []cai.Asset{{
Name: name,
Type: ComputeProjectCloudArmorTierAssetType,
Resource: &cai.AssetResource{
Version: "beta",
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/compute/beta/rest",
DiscoveryName: "ProjectCloudArmorTier",
Data: obj,
},
}}, nil
} else {
return []cai.Asset{}, err
}
}

func GetComputeProjectCloudArmorTierApiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]interface{}, error) {
obj := make(map[string]interface{})
cloudArmorTierProp, err := expandComputeProjectCloudArmorTierCloudArmorTier(d.Get("cloud_armor_tier"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("cloud_armor_tier"); !tpgresource.IsEmptyValue(reflect.ValueOf(cloudArmorTierProp)) && (ok || !reflect.DeepEqual(v, cloudArmorTierProp)) {
obj["cloudArmorTier"] = cloudArmorTierProp
}

return obj, nil
}

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