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

Compute public advertised prefixes #854

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 @@ -16,7 +16,7 @@ require (
github.com/hashicorp/terraform-json v0.14.0
github.com/hashicorp/terraform-plugin-framework v1.1.1
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0
github.com/hashicorp/terraform-provider-google v1.20.1-0.20230413163638-e95fdcb2cb93
github.com/hashicorp/terraform-provider-google v1.20.1-0.20230413174548-7d42944d7bb3
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ github.com/hashicorp/terraform-plugin-mux v0.8.0 h1:WCTP66mZ+iIaIrCNJnjPEYnVjawT
github.com/hashicorp/terraform-plugin-mux v0.8.0/go.mod h1:vdW0daEi8Kd4RFJmet5Ot+SIVB/B8SwQVJiYKQwdCy8=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0 h1:FtCLTiTcykdsURXPt/ku7fYXm3y19nbzbZcUxHx9RbI=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0/go.mod h1:80wf5oad1tW+oLnbXS4UTYmDCrl7BuN1Q+IA91X1a4Y=
github.com/hashicorp/terraform-provider-google v1.20.1-0.20230413163638-e95fdcb2cb93 h1:lG6upp3vddtt/j/rXT06U0kwpWiGCzRHXH255XYWbCw=
github.com/hashicorp/terraform-provider-google v1.20.1-0.20230413163638-e95fdcb2cb93/go.mod h1:V+5ZCfguA0aEhx6Tgxtz/M6BmqGSBSNvx3q1XNRxQX4=
github.com/hashicorp/terraform-provider-google v1.20.1-0.20230413174548-7d42944d7bb3 h1:QvuQnw27GMKkbZeO0Axsu6MFsCDwt1C5s+jAR2foLF8=
github.com/hashicorp/terraform-provider-google v1.20.1-0.20230413174548-7d42944d7bb3/go.mod h1:V+5ZCfguA0aEhx6Tgxtz/M6BmqGSBSNvx3q1XNRxQX4=
github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U=
github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A=
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// ----------------------------------------------------------------------------
//
// *** 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 google

import "reflect"

const ComputePublicAdvertisedPrefixAssetType string = "compute.googleapis.com/PublicAdvertisedPrefix"

func resourceConverterComputePublicAdvertisedPrefix() ResourceConverter {
return ResourceConverter{
AssetType: ComputePublicAdvertisedPrefixAssetType,
Convert: GetComputePublicAdvertisedPrefixCaiObject,
}
}

func GetComputePublicAdvertisedPrefixCaiObject(d TerraformResourceData, config *Config) ([]Asset, error) {
name, err := assetName(d, config, "//compute.googleapis.com/projects/{{project}}/global/publicAdvertisedPrefixes/{{name}}")
if err != nil {
return []Asset{}, err
}
if obj, err := GetComputePublicAdvertisedPrefixApiObject(d, config); err == nil {
return []Asset{{
Name: name,
Type: ComputePublicAdvertisedPrefixAssetType,
Resource: &AssetResource{
Version: "v1",
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest",
DiscoveryName: "PublicAdvertisedPrefix",
Data: obj,
},
}}, nil
} else {
return []Asset{}, err
}
}

func GetComputePublicAdvertisedPrefixApiObject(d TerraformResourceData, config *Config) (map[string]interface{}, error) {
obj := make(map[string]interface{})
descriptionProp, err := expandComputePublicAdvertisedPrefixDescription(d.Get("description"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
obj["description"] = descriptionProp
}
nameProp, err := expandComputePublicAdvertisedPrefixName(d.Get("name"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(nameProp)) && (ok || !reflect.DeepEqual(v, nameProp)) {
obj["name"] = nameProp
}
dnsVerificationIpProp, err := expandComputePublicAdvertisedPrefixDnsVerificationIp(d.Get("dns_verification_ip"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("dns_verification_ip"); !isEmptyValue(reflect.ValueOf(dnsVerificationIpProp)) && (ok || !reflect.DeepEqual(v, dnsVerificationIpProp)) {
obj["dnsVerificationIp"] = dnsVerificationIpProp
}
ipCidrRangeProp, err := expandComputePublicAdvertisedPrefixIpCidrRange(d.Get("ip_cidr_range"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("ip_cidr_range"); !isEmptyValue(reflect.ValueOf(ipCidrRangeProp)) && (ok || !reflect.DeepEqual(v, ipCidrRangeProp)) {
obj["ipCidrRange"] = ipCidrRangeProp
}

return obj, nil
}

func expandComputePublicAdvertisedPrefixDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandComputePublicAdvertisedPrefixName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandComputePublicAdvertisedPrefixDnsVerificationIp(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandComputePublicAdvertisedPrefixIpCidrRange(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// ----------------------------------------------------------------------------
//
// *** 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 google

import "reflect"

const ComputePublicDelegatedPrefixAssetType string = "compute.googleapis.com/PublicDelegatedPrefix"

func resourceConverterComputePublicDelegatedPrefix() ResourceConverter {
return ResourceConverter{
AssetType: ComputePublicDelegatedPrefixAssetType,
Convert: GetComputePublicDelegatedPrefixCaiObject,
}
}

func GetComputePublicDelegatedPrefixCaiObject(d TerraformResourceData, config *Config) ([]Asset, error) {
name, err := assetName(d, config, "//compute.googleapis.com/projects/{{project}}/regions/{{region}}/publicDelegatedPrefixes/{{name}}")
if err != nil {
return []Asset{}, err
}
if obj, err := GetComputePublicDelegatedPrefixApiObject(d, config); err == nil {
return []Asset{{
Name: name,
Type: ComputePublicDelegatedPrefixAssetType,
Resource: &AssetResource{
Version: "v1",
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest",
DiscoveryName: "PublicDelegatedPrefix",
Data: obj,
},
}}, nil
} else {
return []Asset{}, err
}
}

func GetComputePublicDelegatedPrefixApiObject(d TerraformResourceData, config *Config) (map[string]interface{}, error) {
obj := make(map[string]interface{})
descriptionProp, err := expandComputePublicDelegatedPrefixDescription(d.Get("description"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
obj["description"] = descriptionProp
}
isLiveMigrationProp, err := expandComputePublicDelegatedPrefixIsLiveMigration(d.Get("is_live_migration"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("is_live_migration"); !isEmptyValue(reflect.ValueOf(isLiveMigrationProp)) && (ok || !reflect.DeepEqual(v, isLiveMigrationProp)) {
obj["isLiveMigration"] = isLiveMigrationProp
}
nameProp, err := expandComputePublicDelegatedPrefixName(d.Get("name"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(nameProp)) && (ok || !reflect.DeepEqual(v, nameProp)) {
obj["name"] = nameProp
}
parentPrefixProp, err := expandComputePublicDelegatedPrefixParentPrefix(d.Get("parent_prefix"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("parent_prefix"); !isEmptyValue(reflect.ValueOf(parentPrefixProp)) && (ok || !reflect.DeepEqual(v, parentPrefixProp)) {
obj["parentPrefix"] = parentPrefixProp
}
ipCidrRangeProp, err := expandComputePublicDelegatedPrefixIpCidrRange(d.Get("ip_cidr_range"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("ip_cidr_range"); !isEmptyValue(reflect.ValueOf(ipCidrRangeProp)) && (ok || !reflect.DeepEqual(v, ipCidrRangeProp)) {
obj["ipCidrRange"] = ipCidrRangeProp
}

return obj, nil
}

func expandComputePublicDelegatedPrefixDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandComputePublicDelegatedPrefixIsLiveMigration(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandComputePublicDelegatedPrefixName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandComputePublicDelegatedPrefixParentPrefix(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandComputePublicDelegatedPrefixIpCidrRange(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}