| // Copyright (c) HashiCorp, Inc. |
| // SPDX-License-Identifier: MPL-2.0 |
| |
| // ---------------------------------------------------------------------------- |
| // |
| // *** 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 gkeonprem |
| |
| import ( |
| "fmt" |
| "log" |
| "net/http" |
| "reflect" |
| "strings" |
| "time" |
| |
| "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" |
| "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" |
| |
| "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" |
| transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" |
| "github.com/hashicorp/terraform-provider-google-beta/google-beta/verify" |
| ) |
| |
| func ResourceGkeonpremBareMetalCluster() *schema.Resource { |
| return &schema.Resource{ |
| Create: resourceGkeonpremBareMetalClusterCreate, |
| Read: resourceGkeonpremBareMetalClusterRead, |
| Update: resourceGkeonpremBareMetalClusterUpdate, |
| Delete: resourceGkeonpremBareMetalClusterDelete, |
| |
| Importer: &schema.ResourceImporter{ |
| State: resourceGkeonpremBareMetalClusterImport, |
| }, |
| |
| Timeouts: &schema.ResourceTimeout{ |
| Create: schema.DefaultTimeout(60 * time.Minute), |
| Update: schema.DefaultTimeout(60 * time.Minute), |
| Delete: schema.DefaultTimeout(60 * time.Minute), |
| }, |
| |
| CustomizeDiff: customdiff.All( |
| tpgresource.SetAnnotationsDiff, |
| tpgresource.DefaultProviderProject, |
| ), |
| |
| Schema: map[string]*schema.Schema{ |
| "admin_cluster_membership": { |
| Type: schema.TypeString, |
| Required: true, |
| ForceNew: true, |
| DiffSuppressFunc: tpgresource.ProjectNumberDiffSuppress, |
| Description: `The Admin Cluster this Bare Metal User Cluster belongs to. |
| This is the full resource name of the Admin Cluster's hub membership.`, |
| }, |
| "bare_metal_version": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `A human readable description of this Bare Metal User Cluster.`, |
| }, |
| "control_plane": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `Specifies the control plane configuration.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "control_plane_node_pool_config": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `Configures the node pool running the control plane. If specified the corresponding NodePool will be created for the cluster's control plane. The NodePool will have the same name and namespace as the cluster.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "node_pool_config": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `The generic configuration for a node pool running the control plane.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "labels": { |
| Type: schema.TypeMap, |
| Computed: true, |
| Optional: true, |
| Description: `The map of Kubernetes labels (key/value pairs) to be applied to |
| each node. These will added in addition to any default label(s) |
| that Kubernetes may apply to the node. In case of conflict in |
| label keys, the applied set may differ depending on the Kubernetes |
| version -- it's best to assume the behavior is undefined and |
| conflicts should be avoided. For more information, including usage |
| and the valid values, see: |
| - http://kubernetes.io/v1.1/docs/user-guide/labels.html |
| An object containing a list of "key": value pairs. |
| For example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.`, |
| Elem: &schema.Schema{Type: schema.TypeString}, |
| }, |
| "node_configs": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `The list of machine addresses in the Bare Metal Node Pool.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "labels": { |
| Type: schema.TypeMap, |
| Optional: true, |
| Description: `The map of Kubernetes labels (key/value pairs) to be applied to |
| each node. These will added in addition to any default label(s) |
| that Kubernetes may apply to the node. In case of conflict in |
| label keys, the applied set may differ depending on the Kubernetes |
| version -- it's best to assume the behavior is undefined and |
| conflicts should be avoided. For more information, including usage |
| and the valid values, see: |
| - http://kubernetes.io/v1.1/docs/user-guide/labels.html |
| An object containing a list of "key": value pairs. |
| Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.`, |
| Elem: &schema.Schema{Type: schema.TypeString}, |
| }, |
| "node_ip": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `The default IPv4 address for SSH access and Kubernetes node. |
| Example: 192.168.0.1`, |
| }, |
| }, |
| }, |
| }, |
| "operating_system": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `Specifies the nodes operating system (default: LINUX).`, |
| Default: "LINUX", |
| }, |
| "taints": { |
| Type: schema.TypeList, |
| Computed: true, |
| Optional: true, |
| Description: `The initial taints assigned to nodes of this node pool.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "effect": { |
| Type: schema.TypeString, |
| Optional: true, |
| ValidateFunc: verify.ValidateEnum([]string{"EFFECT_UNSPECIFIED", "PREFER_NO_SCHEDULE", "NO_EXECUTE", ""}), |
| Description: `Specifies the nodes operating system (default: LINUX). Possible values: ["EFFECT_UNSPECIFIED", "PREFER_NO_SCHEDULE", "NO_EXECUTE"]`, |
| }, |
| "key": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `Key associated with the effect.`, |
| }, |
| "value": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `Value associated with the effect.`, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| "api_server_args": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Customizes the default API server args. Only a subset of |
| customized flags are supported. Please refer to the API server |
| documentation below to know the exact format: |
| https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "argument": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `The argument name as it appears on the API Server command line please make sure to remove the leading dashes.`, |
| }, |
| "value": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `The value of the arg as it will be passed to the API Server command line.`, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| "load_balancer": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `Specifies the load balancer configuration.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "port_config": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `Specifies the load balancer ports.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "control_plane_load_balancer_port": { |
| Type: schema.TypeInt, |
| Required: true, |
| Description: `The port that control plane hosted load balancers will listen on.`, |
| }, |
| }, |
| }, |
| }, |
| "vip_config": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `Specified the Bare Metal Load Balancer Config`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "control_plane_vip": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `The VIP which you previously set aside for the Kubernetes API of this Bare Metal User Cluster.`, |
| }, |
| "ingress_vip": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `The VIP which you previously set aside for ingress traffic into this Bare Metal User Cluster.`, |
| }, |
| }, |
| }, |
| }, |
| "bgp_lb_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Configuration for BGP typed load balancers.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "address_pools": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `AddressPools is a list of non-overlapping IP pools used by load balancer |
| typed services. All addresses must be routable to load balancer nodes. |
| IngressVIP must be included in the pools.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "addresses": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `The addresses that are part of this pool. Each address must be either in the CIDR form (1.2.3.0/24) or range form (1.2.3.1-1.2.3.5).`, |
| Elem: &schema.Schema{ |
| Type: schema.TypeString, |
| }, |
| }, |
| "pool": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `The name of the address pool.`, |
| }, |
| "avoid_buggy_ips": { |
| Type: schema.TypeBool, |
| Optional: true, |
| Description: `If true, avoid using IPs ending in .0 or .255. |
| This avoids buggy consumer devices mistakenly dropping IPv4 traffic for those special IP addresses.`, |
| }, |
| "manual_assign": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `If true, prevent IP addresses from being automatically assigned.`, |
| }, |
| }, |
| }, |
| }, |
| "asn": { |
| Type: schema.TypeInt, |
| Required: true, |
| Description: `BGP autonomous system number (ASN) of the cluster. |
| This field can be updated after cluster creation.`, |
| }, |
| "bgp_peer_configs": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `The list of BGP peers that the cluster will connect to. |
| At least one peer must be configured for each control plane node. |
| Control plane nodes will connect to these peers to advertise the control |
| plane VIP. The Services load balancer also uses these peers by default. |
| This field can be updated after cluster creation.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "asn": { |
| Type: schema.TypeInt, |
| Required: true, |
| Description: `BGP autonomous system number (ASN) for the network that contains the |
| external peer device.`, |
| }, |
| "ip_address": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `The IP address of the external peer device.`, |
| }, |
| "control_plane_nodes": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `The IP address of the control plane node that connects to the external |
| peer. |
| If you don't specify any control plane nodes, all control plane nodes |
| can connect to the external peer. If you specify one or more IP addresses, |
| only the nodes specified participate in peering sessions.`, |
| Elem: &schema.Schema{ |
| Type: schema.TypeString, |
| }, |
| }, |
| }, |
| }, |
| }, |
| "load_balancer_node_pool_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Specifies the node pool running data plane load balancing. L2 connectivity |
| is required among nodes in this pool. If missing, the control plane node |
| pool is used for data plane load balancing.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "node_pool_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `The generic configuration for a node pool running a load balancer.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "kubelet_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `The modifiable kubelet configurations for the baremetal machines.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "registry_burst": { |
| Type: schema.TypeInt, |
| Optional: true, |
| Description: `The maximum size of bursty pulls, temporarily allows pulls to burst to this |
| number, while still not exceeding registry_pull_qps. |
| The value must not be a negative number. |
| Updating this field may impact scalability by changing the amount of |
| traffic produced by image pulls. |
| Defaults to 10.`, |
| Default: 10, |
| }, |
| "registry_pull_qps": { |
| Type: schema.TypeInt, |
| Optional: true, |
| Description: `The limit of registry pulls per second. |
| Setting this value to 0 means no limit. |
| Updating this field may impact scalability by changing the amount of |
| traffic produced by image pulls. |
| Defaults to 5.`, |
| Default: 5, |
| }, |
| "serialize_image_pulls_disabled": { |
| Type: schema.TypeBool, |
| Optional: true, |
| Description: `Prevents the Kubelet from pulling multiple images at a time. |
| We recommend *not* changing the default value on nodes that run docker |
| daemon with version < 1.9 or an Another Union File System (Aufs) storage |
| backend. Issue https://github.com/kubernetes/kubernetes/issues/10959 has |
| more details.`, |
| }, |
| }, |
| }, |
| }, |
| "labels": { |
| Type: schema.TypeMap, |
| Optional: true, |
| Description: `The map of Kubernetes labels (key/value pairs) to be applied to |
| each node. These will added in addition to any default label(s) |
| that Kubernetes may apply to the node. In case of conflict in |
| label keys, the applied set may differ depending on the Kubernetes |
| version -- it's best to assume the behavior is undefined and |
| conflicts should be avoided. For more information, including usage |
| and the valid values, see: |
| - http://kubernetes.io/v1.1/docs/user-guide/labels.html |
| An object containing a list of "key": value pairs. |
| For example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.`, |
| Elem: &schema.Schema{Type: schema.TypeString}, |
| }, |
| "node_configs": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `The list of machine addresses in the Bare Metal Node Pool.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "labels": { |
| Type: schema.TypeMap, |
| Optional: true, |
| Description: `The map of Kubernetes labels (key/value pairs) to be applied to |
| each node. These will added in addition to any default label(s) |
| that Kubernetes may apply to the node. In case of conflict in |
| label keys, the applied set may differ depending on the Kubernetes |
| version -- it's best to assume the behavior is undefined and |
| conflicts should be avoided. For more information, including usage |
| and the valid values, see: |
| - http://kubernetes.io/v1.1/docs/user-guide/labels.html |
| An object containing a list of "key": value pairs. |
| For example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.`, |
| Elem: &schema.Schema{Type: schema.TypeString}, |
| }, |
| "node_ip": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `The default IPv4 address for SSH access and Kubernetes node. |
| Example: 192.168.0.1`, |
| }, |
| }, |
| }, |
| }, |
| "operating_system": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `Specifies the nodes operating system (default: LINUX).`, |
| }, |
| "taints": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `The initial taints assigned to nodes of this node pool.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "effect": { |
| Type: schema.TypeString, |
| Optional: true, |
| ValidateFunc: verify.ValidateEnum([]string{"EFFECT_UNSPECIFIED", "PREFER_NO_SCHEDULE", "NO_EXECUTE", ""}), |
| Description: `Specifies the nodes operating system (default: LINUX). Possible values: ["EFFECT_UNSPECIFIED", "PREFER_NO_SCHEDULE", "NO_EXECUTE"]`, |
| }, |
| "key": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `Key associated with the effect.`, |
| }, |
| "value": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `Value associated with the effect.`, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| ExactlyOneOf: []string{"load_balancer.0.metal_lb_config", "load_balancer.0.manual_lb_config", "load_balancer.0.bgp_lb_config"}, |
| }, |
| "manual_lb_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `A nested object resource`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "enabled": { |
| Type: schema.TypeBool, |
| Required: true, |
| Description: `Whether manual load balancing is enabled.`, |
| }, |
| }, |
| }, |
| ExactlyOneOf: []string{"load_balancer.0.metal_lb_config", "load_balancer.0.manual_lb_config", "load_balancer.0.bgp_lb_config"}, |
| }, |
| "metal_lb_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `A nested object resource`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "address_pools": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `AddressPools is a list of non-overlapping IP pools used by load balancer |
| typed services. All addresses must be routable to load balancer nodes. |
| IngressVIP must be included in the pools.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "addresses": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `The addresses that are part of this pool. Each address must be either in the CIDR form (1.2.3.0/24) or range form (1.2.3.1-1.2.3.5).`, |
| Elem: &schema.Schema{ |
| Type: schema.TypeString, |
| }, |
| }, |
| "pool": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `The name of the address pool.`, |
| }, |
| "avoid_buggy_ips": { |
| Type: schema.TypeBool, |
| Optional: true, |
| Description: `If true, avoid using IPs ending in .0 or .255. |
| This avoids buggy consumer devices mistakenly dropping IPv4 traffic for those special IP addresses.`, |
| }, |
| "manual_assign": { |
| Type: schema.TypeBool, |
| Optional: true, |
| Description: `If true, prevent IP addresses from being automatically assigned.`, |
| }, |
| }, |
| }, |
| }, |
| "load_balancer_node_pool_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Specifies the load balancer's node pool configuration.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "node_pool_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `The generic configuration for a node pool running a load balancer.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "labels": { |
| Type: schema.TypeMap, |
| Computed: true, |
| Optional: true, |
| Description: `The map of Kubernetes labels (key/value pairs) to be applied to |
| each node. These will added in addition to any default label(s) |
| that Kubernetes may apply to the node. In case of conflict in |
| label keys, the applied set may differ depending on the Kubernetes |
| version -- it's best to assume the behavior is undefined and |
| conflicts should be avoided. For more information, including usage |
| and the valid values, see: |
| - http://kubernetes.io/v1.1/docs/user-guide/labels.html |
| An object containing a list of "key": value pairs. |
| For example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.`, |
| Elem: &schema.Schema{Type: schema.TypeString}, |
| }, |
| "node_configs": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `The list of machine addresses in the Bare Metal Node Pool.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "labels": { |
| Type: schema.TypeMap, |
| Optional: true, |
| Description: `The map of Kubernetes labels (key/value pairs) to be applied to |
| each node. These will added in addition to any default label(s) |
| that Kubernetes may apply to the node. In case of conflict in |
| label keys, the applied set may differ depending on the Kubernetes |
| version -- it's best to assume the behavior is undefined and |
| conflicts should be avoided. For more information, including usage |
| and the valid values, see: |
| - http://kubernetes.io/v1.1/docs/user-guide/labels.html |
| An object containing a list of "key": value pairs. |
| For example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.`, |
| Elem: &schema.Schema{Type: schema.TypeString}, |
| }, |
| "node_ip": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `The default IPv4 address for SSH access and Kubernetes node. |
| Example: 192.168.0.1`, |
| }, |
| }, |
| }, |
| }, |
| "operating_system": { |
| Type: schema.TypeString, |
| Computed: true, |
| Optional: true, |
| Description: `Specifies the nodes operating system (default: LINUX).`, |
| }, |
| "taints": { |
| Type: schema.TypeList, |
| Computed: true, |
| Optional: true, |
| Description: `The initial taints assigned to nodes of this node pool.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "effect": { |
| Type: schema.TypeString, |
| Optional: true, |
| ValidateFunc: verify.ValidateEnum([]string{"EFFECT_UNSPECIFIED", "PREFER_NO_SCHEDULE", "NO_EXECUTE", ""}), |
| Description: `Specifies the nodes operating system (default: LINUX). Possible values: ["EFFECT_UNSPECIFIED", "PREFER_NO_SCHEDULE", "NO_EXECUTE"]`, |
| }, |
| "key": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `Key associated with the effect.`, |
| }, |
| "value": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `Value associated with the effect.`, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| ExactlyOneOf: []string{"load_balancer.0.metal_lb_config", "load_balancer.0.manual_lb_config", "load_balancer.0.bgp_lb_config"}, |
| }, |
| }, |
| }, |
| }, |
| "location": { |
| Type: schema.TypeString, |
| Required: true, |
| ForceNew: true, |
| Description: `The location of the resource.`, |
| }, |
| "name": { |
| Type: schema.TypeString, |
| Required: true, |
| ForceNew: true, |
| Description: `The bare metal cluster name.`, |
| }, |
| "network_config": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `Network configuration.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "advanced_networking": { |
| Type: schema.TypeBool, |
| Optional: true, |
| Description: `Enables the use of advanced Anthos networking features, such as Bundled |
| Load Balancing with BGP or the egress NAT gateway. |
| Setting configuration for advanced networking features will automatically |
| set this flag.`, |
| }, |
| "island_mode_cidr": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `A nested object resource`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "pod_address_cidr_blocks": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `All pods in the cluster are assigned an RFC1918 IPv4 address from these ranges. This field cannot be changed after creation.`, |
| Elem: &schema.Schema{ |
| Type: schema.TypeString, |
| }, |
| }, |
| "service_address_cidr_blocks": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `All services in the cluster are assigned an RFC1918 IPv4 address from these ranges. This field cannot be changed after creation.`, |
| Elem: &schema.Schema{ |
| Type: schema.TypeString, |
| }, |
| }, |
| }, |
| }, |
| ExactlyOneOf: []string{"network_config.0.island_mode_cidr"}, |
| }, |
| "multiple_network_interfaces_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Configuration for multiple network interfaces.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "enabled": { |
| Type: schema.TypeBool, |
| Optional: true, |
| Description: `Whether to enable multiple network interfaces for your pods. |
| When set network_config.advanced_networking is automatically |
| set to true.`, |
| }, |
| }, |
| }, |
| }, |
| "sr_iov_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Configuration for SR-IOV.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "enabled": { |
| Type: schema.TypeBool, |
| Optional: true, |
| Description: `Whether to install the SR-IOV operator.`, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| "storage": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `Specifies the cluster storage configuration.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "lvp_node_mounts_config": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `Specifies the config for local PersistentVolumes backed |
| by mounted node disks. These disks need to be formatted and mounted by the |
| user, which can be done before or after cluster creation.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "path": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `The host machine path.`, |
| }, |
| "storage_class": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `The StorageClass name that PVs will be created with.`, |
| }, |
| }, |
| }, |
| }, |
| "lvp_share_config": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `Specifies the config for local PersistentVolumes backed by |
| subdirectories in a shared filesystem. These subdirectores are |
| automatically created during cluster creation.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "lvp_config": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `Defines the machine path and storage class for the LVP Share.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "path": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `The host machine path.`, |
| }, |
| "storage_class": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `The StorageClass name that PVs will be created with.`, |
| }, |
| }, |
| }, |
| }, |
| "shared_path_pv_count": { |
| Type: schema.TypeInt, |
| Optional: true, |
| Description: `The number of subdirectories to create under path.`, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| "annotations": { |
| Type: schema.TypeMap, |
| Optional: true, |
| Description: `Annotations on the Bare Metal User Cluster. |
| This field has the same restrictions as Kubernetes annotations. |
| The total size of all keys and values combined is limited to 256k. |
| Key can have 2 segments: prefix (optional) and name (required), |
| separated by a slash (/). |
| Prefix must be a DNS subdomain. |
| Name must be 63 characters or less, begin and end with alphanumerics, |
| with dashes (-), underscores (_), dots (.), and alphanumerics between. |
| |
| |
| **Note**: This field is non-authoritative, and will only manage the annotations present in your configuration. |
| Please refer to the field 'effective_annotations' for all of the annotations present on the resource.`, |
| Elem: &schema.Schema{Type: schema.TypeString}, |
| }, |
| "binary_authorization": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Binary Authorization related configurations.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "evaluation_mode": { |
| Type: schema.TypeString, |
| Optional: true, |
| ValidateFunc: verify.ValidateEnum([]string{"DISABLED", "PROJECT_SINGLETON_POLICY_ENFORCE", ""}), |
| Description: `Mode of operation for binauthz policy evaluation. If unspecified, |
| defaults to DISABLED. Possible values: ["DISABLED", "PROJECT_SINGLETON_POLICY_ENFORCE"]`, |
| }, |
| }, |
| }, |
| }, |
| "cluster_operations": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Specifies the User Cluster's observability infrastructure.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "enable_application_logs": { |
| Type: schema.TypeBool, |
| Optional: true, |
| Description: `Whether collection of application logs/metrics should be enabled (in addition to system logs/metrics).`, |
| }, |
| }, |
| }, |
| }, |
| "description": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `A human readable description of this Bare Metal User Cluster.`, |
| }, |
| "maintenance_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Specifies the workload node configurations.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "maintenance_address_cidr_blocks": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `All IPv4 address from these ranges will be placed into maintenance mode. |
| Nodes in maintenance mode will be cordoned and drained. When both of these |
| are true, the "baremetal.cluster.gke.io/maintenance" annotation will be set |
| on the node resource.`, |
| Elem: &schema.Schema{ |
| Type: schema.TypeString, |
| }, |
| }, |
| }, |
| }, |
| }, |
| "node_access_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Specifies the node access related settings for the bare metal user cluster.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "login_user": { |
| Type: schema.TypeString, |
| Computed: true, |
| Optional: true, |
| Description: `LoginUser is the user name used to access node machines. |
| It defaults to "root" if not set.`, |
| }, |
| }, |
| }, |
| }, |
| "node_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Specifies the workload node configurations.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "container_runtime": { |
| Type: schema.TypeString, |
| Computed: true, |
| Optional: true, |
| ValidateFunc: verify.ValidateEnum([]string{"CONTAINER_RUNTIME_UNSPECIFIED", "DOCKER", "CONTAINERD", ""}), |
| Description: `The available runtimes that can be used to run containers in a Bare Metal User Cluster. Possible values: ["CONTAINER_RUNTIME_UNSPECIFIED", "DOCKER", "CONTAINERD"]`, |
| }, |
| "max_pods_per_node": { |
| Type: schema.TypeInt, |
| Computed: true, |
| Optional: true, |
| Description: `The maximum number of pods a node can run. The size of the CIDR range |
| assigned to the node will be derived from this parameter.`, |
| }, |
| }, |
| }, |
| }, |
| "os_environment_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `OS environment related configurations.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "package_repo_excluded": { |
| Type: schema.TypeBool, |
| Required: true, |
| Description: `Whether the package repo should not be included when initializing |
| bare metal machines.`, |
| }, |
| }, |
| }, |
| }, |
| "proxy": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Specifies the cluster proxy configuration.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "uri": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `Specifies the address of your proxy server. |
| For example: http://domain |
| WARNING: Do not provide credentials in the format |
| of http://(username:password@)domain these will be rejected by the server.`, |
| }, |
| "no_proxy": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `A list of IPs, hostnames, and domains that should skip the proxy. |
| For example ["127.0.0.1", "example.com", ".corp", "localhost"].`, |
| Elem: &schema.Schema{ |
| Type: schema.TypeString, |
| }, |
| }, |
| }, |
| }, |
| }, |
| "security_config": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Specifies the security related settings for the Bare Metal User Cluster.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "authorization": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `Configures user access to the Bare Metal User cluster.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "admin_users": { |
| Type: schema.TypeList, |
| Required: true, |
| Description: `Users that will be granted the cluster-admin role on the cluster, providing full access to the cluster.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "username": { |
| Type: schema.TypeString, |
| Required: true, |
| Description: `The name of the user, e.g. 'my-gcp-id@gmail.com'.`, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| "upgrade_policy": { |
| Type: schema.TypeList, |
| Optional: true, |
| Description: `The cluster upgrade policy.`, |
| MaxItems: 1, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "policy": { |
| Type: schema.TypeString, |
| Optional: true, |
| ValidateFunc: verify.ValidateEnum([]string{"SERIAL", "CONCURRENT", ""}), |
| Description: `Specifies which upgrade policy to use. Possible values: ["SERIAL", "CONCURRENT"]`, |
| }, |
| }, |
| }, |
| }, |
| "create_time": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `The time the cluster was created, in RFC3339 text format.`, |
| }, |
| "delete_time": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `The time the cluster was deleted, in RFC3339 text format.`, |
| }, |
| "effective_annotations": { |
| Type: schema.TypeMap, |
| Computed: true, |
| Description: `All of annotations (key/value pairs) present on the resource in GCP, including the annotations configured through Terraform, other clients and services.`, |
| Elem: &schema.Schema{Type: schema.TypeString}, |
| }, |
| "endpoint": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `The IP address name of Bare Metal User Cluster's API server.`, |
| }, |
| "etag": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `This checksum is computed by the server based on the value of other |
| fields, and may be sent on update and delete requests to ensure the |
| client has an up-to-date value before proceeding. |
| Allows clients to perform consistent read-modify-writes |
| through optimistic concurrency control.`, |
| }, |
| "fleet": { |
| Type: schema.TypeList, |
| Computed: true, |
| Description: `Fleet related configuration. |
| Fleets are a Google Cloud concept for logically organizing clusters, |
| letting you use and manage multi-cluster capabilities and apply |
| consistent policies across your systems. |
| See [Anthos Fleets](https://cloud.google.com/anthos/multicluster-management/fleets) for |
| more details on Anthos multi-cluster capabilities using Fleets.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "membership": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `The name of the managed Hub Membership resource associated to this cluster. |
| Membership names are formatted as |
| 'projects/<project-number>/locations/<location>/memberships/<cluster-id>'.`, |
| }, |
| }, |
| }, |
| }, |
| "local_name": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `The object name of the Bare Metal Cluster custom resource on the |
| associated admin cluster. This field is used to support conflicting |
| names when enrolling existing clusters to the API. When used as a part of |
| cluster enrollment, this field will differ from the ID in the resource |
| name. For new clusters, this field will match the user provided cluster ID |
| and be visible in the last component of the resource name. It is not |
| modifiable. |
| All users should use this name to access their cluster using gkectl or |
| kubectl and should expect to see the local name when viewing admin |
| cluster controller logs.`, |
| }, |
| "reconciling": { |
| Type: schema.TypeBool, |
| Computed: true, |
| Description: `If set, there are currently changes in flight to the Bare Metal User Cluster.`, |
| }, |
| "state": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `The current state of this cluster.`, |
| }, |
| "status": { |
| Type: schema.TypeList, |
| Computed: true, |
| Description: `Specifies detailed cluster status.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "conditions": { |
| Type: schema.TypeList, |
| Computed: true, |
| Description: `ResourceConditions provide a standard mechanism for higher-level status reporting from user cluster controller.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "message": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `Human-readable message indicating details about last transition.`, |
| }, |
| "reason": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `Machine-readable message indicating details about last transition.`, |
| }, |
| "type": { |
| Type: schema.TypeString, |
| Optional: true, |
| Description: `Type of the condition. |
| (e.g., ClusterRunning, NodePoolRunning or ServerSidePreflightReady)`, |
| }, |
| "last_transition_time": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `Last time the condition transit from one status to another.`, |
| }, |
| "state": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `The lifecycle state of the condition.`, |
| }, |
| }, |
| }, |
| }, |
| "error_message": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `Human-friendly representation of the error message from the user cluster |
| controller. The error message can be temporary as the user cluster |
| controller creates a cluster or node pool. If the error message persists |
| for a longer period of time, it can be used to surface error message to |
| indicate real problems requiring user intervention.`, |
| }, |
| }, |
| }, |
| }, |
| "uid": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `The unique identifier of the Bare Metal User Cluster.`, |
| }, |
| "update_time": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `The time the cluster was last updated, in RFC3339 text format.`, |
| }, |
| "validation_check": { |
| Type: schema.TypeList, |
| Computed: true, |
| Description: `Specifies the security related settings for the Bare Metal User Cluster.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "options": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `Options used for the validation check.`, |
| }, |
| "scenario": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `The scenario when the preflight checks were run..`, |
| }, |
| "status": { |
| Type: schema.TypeList, |
| Computed: true, |
| Description: `Specifies the detailed validation check status`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "result": { |
| Type: schema.TypeList, |
| Computed: true, |
| Description: `Individual checks which failed as part of the Preflight check execution.`, |
| Elem: &schema.Resource{ |
| Schema: map[string]*schema.Schema{ |
| "category": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `The category of the validation.`, |
| }, |
| "description": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `The description of the validation check.`, |
| }, |
| "details": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `Detailed failure information, which might be unformatted.`, |
| }, |
| "options": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `Options used for the validation check.`, |
| }, |
| "reason": { |
| Type: schema.TypeString, |
| Computed: true, |
| Description: `A human-readable message of the check failure.`, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| "project": { |
| Type: schema.TypeString, |
| Optional: true, |
| Computed: true, |
| ForceNew: true, |
| }, |
| }, |
| UseJSONNumber: true, |
| } |
| } |
| |
| func resourceGkeonpremBareMetalClusterCreate(d *schema.ResourceData, meta interface{}) error { |
| config := meta.(*transport_tpg.Config) |
| userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) |
| if err != nil { |
| return err |
| } |
| |
| obj := make(map[string]interface{}) |
| adminClusterMembershipProp, err := expandGkeonpremBareMetalClusterAdminClusterMembership(d.Get("admin_cluster_membership"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("admin_cluster_membership"); !tpgresource.IsEmptyValue(reflect.ValueOf(adminClusterMembershipProp)) && (ok || !reflect.DeepEqual(v, adminClusterMembershipProp)) { |
| obj["adminClusterMembership"] = adminClusterMembershipProp |
| } |
| descriptionProp, err := expandGkeonpremBareMetalClusterDescription(d.Get("description"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("description"); !tpgresource.IsEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { |
| obj["description"] = descriptionProp |
| } |
| bareMetalVersionProp, err := expandGkeonpremBareMetalClusterBareMetalVersion(d.Get("bare_metal_version"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("bare_metal_version"); !tpgresource.IsEmptyValue(reflect.ValueOf(bareMetalVersionProp)) && (ok || !reflect.DeepEqual(v, bareMetalVersionProp)) { |
| obj["bareMetalVersion"] = bareMetalVersionProp |
| } |
| networkConfigProp, err := expandGkeonpremBareMetalClusterNetworkConfig(d.Get("network_config"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("network_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(networkConfigProp)) && (ok || !reflect.DeepEqual(v, networkConfigProp)) { |
| obj["networkConfig"] = networkConfigProp |
| } |
| controlPlaneProp, err := expandGkeonpremBareMetalClusterControlPlane(d.Get("control_plane"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("control_plane"); !tpgresource.IsEmptyValue(reflect.ValueOf(controlPlaneProp)) && (ok || !reflect.DeepEqual(v, controlPlaneProp)) { |
| obj["controlPlane"] = controlPlaneProp |
| } |
| loadBalancerProp, err := expandGkeonpremBareMetalClusterLoadBalancer(d.Get("load_balancer"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("load_balancer"); !tpgresource.IsEmptyValue(reflect.ValueOf(loadBalancerProp)) && (ok || !reflect.DeepEqual(v, loadBalancerProp)) { |
| obj["loadBalancer"] = loadBalancerProp |
| } |
| storageProp, err := expandGkeonpremBareMetalClusterStorage(d.Get("storage"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("storage"); !tpgresource.IsEmptyValue(reflect.ValueOf(storageProp)) && (ok || !reflect.DeepEqual(v, storageProp)) { |
| obj["storage"] = storageProp |
| } |
| proxyProp, err := expandGkeonpremBareMetalClusterProxy(d.Get("proxy"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("proxy"); !tpgresource.IsEmptyValue(reflect.ValueOf(proxyProp)) && (ok || !reflect.DeepEqual(v, proxyProp)) { |
| obj["proxy"] = proxyProp |
| } |
| clusterOperationsProp, err := expandGkeonpremBareMetalClusterClusterOperations(d.Get("cluster_operations"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("cluster_operations"); !tpgresource.IsEmptyValue(reflect.ValueOf(clusterOperationsProp)) && (ok || !reflect.DeepEqual(v, clusterOperationsProp)) { |
| obj["clusterOperations"] = clusterOperationsProp |
| } |
| maintenanceConfigProp, err := expandGkeonpremBareMetalClusterMaintenanceConfig(d.Get("maintenance_config"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("maintenance_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(maintenanceConfigProp)) && (ok || !reflect.DeepEqual(v, maintenanceConfigProp)) { |
| obj["maintenanceConfig"] = maintenanceConfigProp |
| } |
| nodeConfigProp, err := expandGkeonpremBareMetalClusterNodeConfig(d.Get("node_config"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("node_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(nodeConfigProp)) && (ok || !reflect.DeepEqual(v, nodeConfigProp)) { |
| obj["nodeConfig"] = nodeConfigProp |
| } |
| nodeAccessConfigProp, err := expandGkeonpremBareMetalClusterNodeAccessConfig(d.Get("node_access_config"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("node_access_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(nodeAccessConfigProp)) && (ok || !reflect.DeepEqual(v, nodeAccessConfigProp)) { |
| obj["nodeAccessConfig"] = nodeAccessConfigProp |
| } |
| osEnvironmentConfigProp, err := expandGkeonpremBareMetalClusterOsEnvironmentConfig(d.Get("os_environment_config"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("os_environment_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(osEnvironmentConfigProp)) && (ok || !reflect.DeepEqual(v, osEnvironmentConfigProp)) { |
| obj["osEnvironmentConfig"] = osEnvironmentConfigProp |
| } |
| securityConfigProp, err := expandGkeonpremBareMetalClusterSecurityConfig(d.Get("security_config"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("security_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(securityConfigProp)) && (ok || !reflect.DeepEqual(v, securityConfigProp)) { |
| obj["securityConfig"] = securityConfigProp |
| } |
| binaryAuthorizationProp, err := expandGkeonpremBareMetalClusterBinaryAuthorization(d.Get("binary_authorization"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("binary_authorization"); !tpgresource.IsEmptyValue(reflect.ValueOf(binaryAuthorizationProp)) && (ok || !reflect.DeepEqual(v, binaryAuthorizationProp)) { |
| obj["binaryAuthorization"] = binaryAuthorizationProp |
| } |
| upgradePolicyProp, err := expandGkeonpremBareMetalClusterUpgradePolicy(d.Get("upgrade_policy"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("upgrade_policy"); !tpgresource.IsEmptyValue(reflect.ValueOf(upgradePolicyProp)) && (ok || !reflect.DeepEqual(v, upgradePolicyProp)) { |
| obj["upgradePolicy"] = upgradePolicyProp |
| } |
| annotationsProp, err := expandGkeonpremBareMetalClusterEffectiveAnnotations(d.Get("effective_annotations"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("effective_annotations"); !tpgresource.IsEmptyValue(reflect.ValueOf(annotationsProp)) && (ok || !reflect.DeepEqual(v, annotationsProp)) { |
| obj["annotations"] = annotationsProp |
| } |
| |
| url, err := tpgresource.ReplaceVars(d, config, "{{GkeonpremBasePath}}projects/{{project}}/locations/{{location}}/bareMetalClusters?bare_metal_cluster_id={{name}}") |
| if err != nil { |
| return err |
| } |
| |
| log.Printf("[DEBUG] Creating new BareMetalCluster: %#v", obj) |
| billingProject := "" |
| |
| project, err := tpgresource.GetProject(d, config) |
| if err != nil { |
| return fmt.Errorf("Error fetching project for BareMetalCluster: %s", err) |
| } |
| billingProject = project |
| |
| // err == nil indicates that the billing_project value was found |
| if bp, err := tpgresource.GetBillingProject(d, config); err == nil { |
| billingProject = bp |
| } |
| |
| headers := make(http.Header) |
| res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ |
| Config: config, |
| Method: "POST", |
| Project: billingProject, |
| RawURL: url, |
| UserAgent: userAgent, |
| Body: obj, |
| Timeout: d.Timeout(schema.TimeoutCreate), |
| Headers: headers, |
| }) |
| if err != nil { |
| return fmt.Errorf("Error creating BareMetalCluster: %s", err) |
| } |
| |
| // Store the ID now |
| id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/bareMetalClusters/{{name}}") |
| if err != nil { |
| return fmt.Errorf("Error constructing id: %s", err) |
| } |
| d.SetId(id) |
| |
| // Use the resource in the operation response to populate |
| // identity fields and d.Id() before read |
| var opRes map[string]interface{} |
| err = GkeonpremOperationWaitTimeWithResponse( |
| config, res, &opRes, project, "Creating BareMetalCluster", userAgent, |
| d.Timeout(schema.TimeoutCreate)) |
| if err != nil { |
| return fmt.Errorf("Error waiting to create BareMetalCluster: %s", err) |
| } |
| |
| // This may have caused the ID to update - update it if so. |
| id, err = tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/bareMetalClusters/{{name}}") |
| if err != nil { |
| return fmt.Errorf("Error constructing id: %s", err) |
| } |
| d.SetId(id) |
| |
| log.Printf("[DEBUG] Finished creating BareMetalCluster %q: %#v", d.Id(), res) |
| |
| return resourceGkeonpremBareMetalClusterRead(d, meta) |
| } |
| |
| func resourceGkeonpremBareMetalClusterRead(d *schema.ResourceData, meta interface{}) error { |
| config := meta.(*transport_tpg.Config) |
| userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) |
| if err != nil { |
| return err |
| } |
| |
| url, err := tpgresource.ReplaceVars(d, config, "{{GkeonpremBasePath}}projects/{{project}}/locations/{{location}}/bareMetalClusters/{{name}}") |
| if err != nil { |
| return err |
| } |
| |
| billingProject := "" |
| |
| project, err := tpgresource.GetProject(d, config) |
| if err != nil { |
| return fmt.Errorf("Error fetching project for BareMetalCluster: %s", err) |
| } |
| billingProject = project |
| |
| // err == nil indicates that the billing_project value was found |
| if bp, err := tpgresource.GetBillingProject(d, config); err == nil { |
| billingProject = bp |
| } |
| |
| headers := make(http.Header) |
| res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ |
| Config: config, |
| Method: "GET", |
| Project: billingProject, |
| RawURL: url, |
| UserAgent: userAgent, |
| Headers: headers, |
| }) |
| if err != nil { |
| return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("GkeonpremBareMetalCluster %q", d.Id())) |
| } |
| |
| if err := d.Set("project", project); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| |
| if err := d.Set("admin_cluster_membership", flattenGkeonpremBareMetalClusterAdminClusterMembership(res["adminClusterMembership"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("description", flattenGkeonpremBareMetalClusterDescription(res["description"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("bare_metal_version", flattenGkeonpremBareMetalClusterBareMetalVersion(res["bareMetalVersion"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("annotations", flattenGkeonpremBareMetalClusterAnnotations(res["annotations"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("network_config", flattenGkeonpremBareMetalClusterNetworkConfig(res["networkConfig"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("control_plane", flattenGkeonpremBareMetalClusterControlPlane(res["controlPlane"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("load_balancer", flattenGkeonpremBareMetalClusterLoadBalancer(res["loadBalancer"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("storage", flattenGkeonpremBareMetalClusterStorage(res["storage"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("proxy", flattenGkeonpremBareMetalClusterProxy(res["proxy"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("cluster_operations", flattenGkeonpremBareMetalClusterClusterOperations(res["clusterOperations"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("maintenance_config", flattenGkeonpremBareMetalClusterMaintenanceConfig(res["maintenanceConfig"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("node_config", flattenGkeonpremBareMetalClusterNodeConfig(res["nodeConfig"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("node_access_config", flattenGkeonpremBareMetalClusterNodeAccessConfig(res["nodeAccessConfig"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("os_environment_config", flattenGkeonpremBareMetalClusterOsEnvironmentConfig(res["osEnvironmentConfig"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("security_config", flattenGkeonpremBareMetalClusterSecurityConfig(res["securityConfig"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("binary_authorization", flattenGkeonpremBareMetalClusterBinaryAuthorization(res["binaryAuthorization"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("upgrade_policy", flattenGkeonpremBareMetalClusterUpgradePolicy(res["upgradePolicy"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("uid", flattenGkeonpremBareMetalClusterUid(res["uid"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("state", flattenGkeonpremBareMetalClusterState(res["state"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("endpoint", flattenGkeonpremBareMetalClusterEndpoint(res["endpoint"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("reconciling", flattenGkeonpremBareMetalClusterReconciling(res["reconciling"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("create_time", flattenGkeonpremBareMetalClusterCreateTime(res["createTime"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("update_time", flattenGkeonpremBareMetalClusterUpdateTime(res["updateTime"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("delete_time", flattenGkeonpremBareMetalClusterDeleteTime(res["deleteTime"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("local_name", flattenGkeonpremBareMetalClusterLocalName(res["localName"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("etag", flattenGkeonpremBareMetalClusterEtag(res["etag"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("fleet", flattenGkeonpremBareMetalClusterFleet(res["fleet"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("status", flattenGkeonpremBareMetalClusterStatus(res["status"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("validation_check", flattenGkeonpremBareMetalClusterValidationCheck(res["validationCheck"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| if err := d.Set("effective_annotations", flattenGkeonpremBareMetalClusterEffectiveAnnotations(res["annotations"], d, config)); err != nil { |
| return fmt.Errorf("Error reading BareMetalCluster: %s", err) |
| } |
| |
| return nil |
| } |
| |
| func resourceGkeonpremBareMetalClusterUpdate(d *schema.ResourceData, meta interface{}) error { |
| config := meta.(*transport_tpg.Config) |
| userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) |
| if err != nil { |
| return err |
| } |
| |
| billingProject := "" |
| |
| project, err := tpgresource.GetProject(d, config) |
| if err != nil { |
| return fmt.Errorf("Error fetching project for BareMetalCluster: %s", err) |
| } |
| billingProject = project |
| |
| obj := make(map[string]interface{}) |
| descriptionProp, err := expandGkeonpremBareMetalClusterDescription(d.Get("description"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("description"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { |
| obj["description"] = descriptionProp |
| } |
| bareMetalVersionProp, err := expandGkeonpremBareMetalClusterBareMetalVersion(d.Get("bare_metal_version"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("bare_metal_version"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, bareMetalVersionProp)) { |
| obj["bareMetalVersion"] = bareMetalVersionProp |
| } |
| networkConfigProp, err := expandGkeonpremBareMetalClusterNetworkConfig(d.Get("network_config"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("network_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, networkConfigProp)) { |
| obj["networkConfig"] = networkConfigProp |
| } |
| controlPlaneProp, err := expandGkeonpremBareMetalClusterControlPlane(d.Get("control_plane"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("control_plane"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, controlPlaneProp)) { |
| obj["controlPlane"] = controlPlaneProp |
| } |
| loadBalancerProp, err := expandGkeonpremBareMetalClusterLoadBalancer(d.Get("load_balancer"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("load_balancer"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, loadBalancerProp)) { |
| obj["loadBalancer"] = loadBalancerProp |
| } |
| storageProp, err := expandGkeonpremBareMetalClusterStorage(d.Get("storage"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("storage"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, storageProp)) { |
| obj["storage"] = storageProp |
| } |
| proxyProp, err := expandGkeonpremBareMetalClusterProxy(d.Get("proxy"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("proxy"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, proxyProp)) { |
| obj["proxy"] = proxyProp |
| } |
| clusterOperationsProp, err := expandGkeonpremBareMetalClusterClusterOperations(d.Get("cluster_operations"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("cluster_operations"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, clusterOperationsProp)) { |
| obj["clusterOperations"] = clusterOperationsProp |
| } |
| maintenanceConfigProp, err := expandGkeonpremBareMetalClusterMaintenanceConfig(d.Get("maintenance_config"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("maintenance_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, maintenanceConfigProp)) { |
| obj["maintenanceConfig"] = maintenanceConfigProp |
| } |
| nodeConfigProp, err := expandGkeonpremBareMetalClusterNodeConfig(d.Get("node_config"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("node_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nodeConfigProp)) { |
| obj["nodeConfig"] = nodeConfigProp |
| } |
| nodeAccessConfigProp, err := expandGkeonpremBareMetalClusterNodeAccessConfig(d.Get("node_access_config"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("node_access_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nodeAccessConfigProp)) { |
| obj["nodeAccessConfig"] = nodeAccessConfigProp |
| } |
| osEnvironmentConfigProp, err := expandGkeonpremBareMetalClusterOsEnvironmentConfig(d.Get("os_environment_config"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("os_environment_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, osEnvironmentConfigProp)) { |
| obj["osEnvironmentConfig"] = osEnvironmentConfigProp |
| } |
| securityConfigProp, err := expandGkeonpremBareMetalClusterSecurityConfig(d.Get("security_config"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("security_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, securityConfigProp)) { |
| obj["securityConfig"] = securityConfigProp |
| } |
| binaryAuthorizationProp, err := expandGkeonpremBareMetalClusterBinaryAuthorization(d.Get("binary_authorization"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("binary_authorization"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, binaryAuthorizationProp)) { |
| obj["binaryAuthorization"] = binaryAuthorizationProp |
| } |
| upgradePolicyProp, err := expandGkeonpremBareMetalClusterUpgradePolicy(d.Get("upgrade_policy"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("upgrade_policy"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, upgradePolicyProp)) { |
| obj["upgradePolicy"] = upgradePolicyProp |
| } |
| annotationsProp, err := expandGkeonpremBareMetalClusterEffectiveAnnotations(d.Get("effective_annotations"), d, config) |
| if err != nil { |
| return err |
| } else if v, ok := d.GetOkExists("effective_annotations"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, annotationsProp)) { |
| obj["annotations"] = annotationsProp |
| } |
| |
| url, err := tpgresource.ReplaceVars(d, config, "{{GkeonpremBasePath}}projects/{{project}}/locations/{{location}}/bareMetalClusters/{{name}}") |
| if err != nil { |
| return err |
| } |
| |
| log.Printf("[DEBUG] Updating BareMetalCluster %q: %#v", d.Id(), obj) |
| headers := make(http.Header) |
| updateMask := []string{} |
| |
| if d.HasChange("description") { |
| updateMask = append(updateMask, "description") |
| } |
| |
| if d.HasChange("bare_metal_version") { |
| updateMask = append(updateMask, "bareMetalVersion") |
| } |
| |
| if d.HasChange("network_config") { |
| updateMask = append(updateMask, "networkConfig") |
| } |
| |
| if d.HasChange("control_plane") { |
| updateMask = append(updateMask, "controlPlane") |
| } |
| |
| if d.HasChange("load_balancer") { |
| updateMask = append(updateMask, "loadBalancer") |
| } |
| |
| if d.HasChange("storage") { |
| updateMask = append(updateMask, "storage") |
| } |
| |
| if d.HasChange("proxy") { |
| updateMask = append(updateMask, "proxy") |
| } |
| |
| if d.HasChange("cluster_operations") { |
| updateMask = append(updateMask, "clusterOperations") |
| } |
| |
| if d.HasChange("maintenance_config") { |
| updateMask = append(updateMask, "maintenanceConfig") |
| } |
| |
| if d.HasChange("node_config") { |
| updateMask = append(updateMask, "nodeConfig") |
| } |
| |
| if d.HasChange("node_access_config") { |
| updateMask = append(updateMask, "nodeAccessConfig") |
| } |
| |
| if d.HasChange("os_environment_config") { |
| updateMask = append(updateMask, "osEnvironmentConfig") |
| } |
| |
| if d.HasChange("security_config") { |
| updateMask = append(updateMask, "securityConfig") |
| } |
| |
| if d.HasChange("binary_authorization") { |
| updateMask = append(updateMask, "binaryAuthorization") |
| } |
| |
| if d.HasChange("upgrade_policy") { |
| updateMask = append(updateMask, "upgradePolicy") |
| } |
| |
| if d.HasChange("effective_annotations") { |
| updateMask = append(updateMask, "annotations") |
| } |
| // updateMask is a URL parameter but not present in the schema, so ReplaceVars |
| // won't set it |
| url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) |
| if err != nil { |
| return err |
| } |
| |
| // err == nil indicates that the billing_project value was found |
| if bp, err := tpgresource.GetBillingProject(d, config); err == nil { |
| billingProject = bp |
| } |
| |
| // if updateMask is empty we are not updating anything so skip the post |
| if len(updateMask) > 0 { |
| res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ |
| Config: config, |
| Method: "PATCH", |
| Project: billingProject, |
| RawURL: url, |
| UserAgent: userAgent, |
| Body: obj, |
| Timeout: d.Timeout(schema.TimeoutUpdate), |
| Headers: headers, |
| }) |
| |
| if err != nil { |
| return fmt.Errorf("Error updating BareMetalCluster %q: %s", d.Id(), err) |
| } else { |
| log.Printf("[DEBUG] Finished updating BareMetalCluster %q: %#v", d.Id(), res) |
| } |
| |
| err = GkeonpremOperationWaitTime( |
| config, res, project, "Updating BareMetalCluster", userAgent, |
| d.Timeout(schema.TimeoutUpdate)) |
| |
| if err != nil { |
| return err |
| } |
| } |
| |
| return resourceGkeonpremBareMetalClusterRead(d, meta) |
| } |
| |
| func resourceGkeonpremBareMetalClusterDelete(d *schema.ResourceData, meta interface{}) error { |
| config := meta.(*transport_tpg.Config) |
| userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) |
| if err != nil { |
| return err |
| } |
| |
| billingProject := "" |
| |
| project, err := tpgresource.GetProject(d, config) |
| if err != nil { |
| return fmt.Errorf("Error fetching project for BareMetalCluster: %s", err) |
| } |
| billingProject = project |
| |
| url, err := tpgresource.ReplaceVars(d, config, "{{GkeonpremBasePath}}projects/{{project}}/locations/{{location}}/bareMetalClusters/{{name}}?force=true") |
| if err != nil { |
| return err |
| } |
| |
| var obj map[string]interface{} |
| |
| // err == nil indicates that the billing_project value was found |
| if bp, err := tpgresource.GetBillingProject(d, config); err == nil { |
| billingProject = bp |
| } |
| |
| headers := make(http.Header) |
| |
| log.Printf("[DEBUG] Deleting BareMetalCluster %q", d.Id()) |
| res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ |
| Config: config, |
| Method: "DELETE", |
| Project: billingProject, |
| RawURL: url, |
| UserAgent: userAgent, |
| Body: obj, |
| Timeout: d.Timeout(schema.TimeoutDelete), |
| Headers: headers, |
| }) |
| if err != nil { |
| return transport_tpg.HandleNotFoundError(err, d, "BareMetalCluster") |
| } |
| |
| err = GkeonpremOperationWaitTime( |
| config, res, project, "Deleting BareMetalCluster", userAgent, |
| d.Timeout(schema.TimeoutDelete)) |
| |
| if err != nil { |
| return err |
| } |
| |
| log.Printf("[DEBUG] Finished deleting BareMetalCluster %q: %#v", d.Id(), res) |
| return nil |
| } |
| |
| func resourceGkeonpremBareMetalClusterImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { |
| config := meta.(*transport_tpg.Config) |
| if err := tpgresource.ParseImportId([]string{ |
| "^projects/(?P<project>[^/]+)/locations/(?P<location>[^/]+)/bareMetalClusters/(?P<name>[^/]+)$", |
| "^(?P<project>[^/]+)/(?P<location>[^/]+)/(?P<name>[^/]+)$", |
| "^(?P<location>[^/]+)/(?P<name>[^/]+)$", |
| }, d, config); err != nil { |
| return nil, err |
| } |
| |
| // Replace import id for the resource id |
| id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/bareMetalClusters/{{name}}") |
| if err != nil { |
| return nil, fmt.Errorf("Error constructing id: %s", err) |
| } |
| d.SetId(id) |
| |
| return []*schema.ResourceData{d}, nil |
| } |
| |
| func flattenGkeonpremBareMetalClusterAdminClusterMembership(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterDescription(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterBareMetalVersion(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterAnnotations(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| |
| transformed := make(map[string]interface{}) |
| if l, ok := d.GetOkExists("annotations"); ok { |
| for k := range l.(map[string]interface{}) { |
| transformed[k] = v.(map[string]interface{})[k] |
| } |
| } |
| |
| return transformed |
| } |
| |
| func flattenGkeonpremBareMetalClusterNetworkConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["island_mode_cidr"] = |
| flattenGkeonpremBareMetalClusterNetworkConfigIslandModeCidr(original["islandModeCidr"], d, config) |
| transformed["advanced_networking"] = |
| flattenGkeonpremBareMetalClusterNetworkConfigAdvancedNetworking(original["advancedNetworking"], d, config) |
| transformed["multiple_network_interfaces_config"] = |
| flattenGkeonpremBareMetalClusterNetworkConfigMultipleNetworkInterfacesConfig(original["multipleNetworkInterfacesConfig"], d, config) |
| transformed["sr_iov_config"] = |
| flattenGkeonpremBareMetalClusterNetworkConfigSrIovConfig(original["srIovConfig"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterNetworkConfigIslandModeCidr(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["service_address_cidr_blocks"] = |
| flattenGkeonpremBareMetalClusterNetworkConfigIslandModeCidrServiceAddressCidrBlocks(original["serviceAddressCidrBlocks"], d, config) |
| transformed["pod_address_cidr_blocks"] = |
| flattenGkeonpremBareMetalClusterNetworkConfigIslandModeCidrPodAddressCidrBlocks(original["podAddressCidrBlocks"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterNetworkConfigIslandModeCidrServiceAddressCidrBlocks(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterNetworkConfigIslandModeCidrPodAddressCidrBlocks(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterNetworkConfigAdvancedNetworking(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterNetworkConfigMultipleNetworkInterfacesConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["enabled"] = |
| flattenGkeonpremBareMetalClusterNetworkConfigMultipleNetworkInterfacesConfigEnabled(original["enabled"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterNetworkConfigMultipleNetworkInterfacesConfigEnabled(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterNetworkConfigSrIovConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["enabled"] = |
| flattenGkeonpremBareMetalClusterNetworkConfigSrIovConfigEnabled(original["enabled"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterNetworkConfigSrIovConfigEnabled(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterControlPlane(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["control_plane_node_pool_config"] = |
| flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfig(original["controlPlaneNodePoolConfig"], d, config) |
| transformed["api_server_args"] = |
| flattenGkeonpremBareMetalClusterControlPlaneApiServerArgs(original["apiServerArgs"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["node_pool_config"] = |
| flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfig(original["nodePoolConfig"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["node_configs"] = |
| flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigNodeConfigs(original["nodeConfigs"], d, config) |
| transformed["operating_system"] = |
| flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigOperatingSystem(original["operatingSystem"], d, config) |
| transformed["taints"] = |
| flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaints(original["taints"], d, config) |
| transformed["labels"] = |
| flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigLabels(original["labels"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigNodeConfigs(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "node_ip": flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigNodeConfigsNodeIp(original["nodeIp"], d, config), |
| "labels": flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigNodeConfigsLabels(original["labels"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigNodeConfigsNodeIp(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigNodeConfigsLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigOperatingSystem(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaints(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "key": flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaintsKey(original["key"], d, config), |
| "value": flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaintsValue(original["value"], d, config), |
| "effect": flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaintsEffect(original["effect"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaintsKey(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaintsValue(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaintsEffect(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterControlPlaneApiServerArgs(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "argument": flattenGkeonpremBareMetalClusterControlPlaneApiServerArgsArgument(original["argument"], d, config), |
| "value": flattenGkeonpremBareMetalClusterControlPlaneApiServerArgsValue(original["value"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterControlPlaneApiServerArgsArgument(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterControlPlaneApiServerArgsValue(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancer(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["vip_config"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerVipConfig(original["vipConfig"], d, config) |
| transformed["port_config"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerPortConfig(original["portConfig"], d, config) |
| transformed["metal_lb_config"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfig(original["metalLbConfig"], d, config) |
| transformed["manual_lb_config"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerManualLbConfig(original["manualLbConfig"], d, config) |
| transformed["bgp_lb_config"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfig(original["bgpLbConfig"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerVipConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["control_plane_vip"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerVipConfigControlPlaneVip(original["controlPlaneVip"], d, config) |
| transformed["ingress_vip"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerVipConfigIngressVip(original["ingressVip"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerVipConfigControlPlaneVip(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerVipConfigIngressVip(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerPortConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["control_plane_load_balancer_port"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerPortConfigControlPlaneLoadBalancerPort(original["controlPlaneLoadBalancerPort"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerPortConfigControlPlaneLoadBalancerPort(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| // Handles the string fixed64 format |
| if strVal, ok := v.(string); ok { |
| if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { |
| return intVal |
| } |
| } |
| |
| // number values are represented as float64 |
| if floatVal, ok := v.(float64); ok { |
| intVal := int(floatVal) |
| return intVal |
| } |
| |
| return v // let terraform core handle it otherwise |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["address_pools"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPools(original["addressPools"], d, config) |
| transformed["load_balancer_node_pool_config"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfig(original["loadBalancerNodePoolConfig"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPools(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "pool": flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsPool(original["pool"], d, config), |
| "addresses": flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsAddresses(original["addresses"], d, config), |
| "avoid_buggy_ips": flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsAvoidBuggyIps(original["avoidBuggyIps"], d, config), |
| "manual_assign": flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsManualAssign(original["manualAssign"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsPool(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsAddresses(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsAvoidBuggyIps(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsManualAssign(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["node_pool_config"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfig(original["nodePoolConfig"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["node_configs"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigs(original["nodeConfigs"], d, config) |
| transformed["operating_system"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigOperatingSystem(original["operatingSystem"], d, config) |
| transformed["taints"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaints(original["taints"], d, config) |
| transformed["labels"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigLabels(original["labels"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigs(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "node_ip": flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsNodeIp(original["nodeIp"], d, config), |
| "labels": flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsLabels(original["labels"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsNodeIp(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigOperatingSystem(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaints(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "key": flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsKey(original["key"], d, config), |
| "value": flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsValue(original["value"], d, config), |
| "effect": flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsEffect(original["effect"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsKey(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsValue(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsEffect(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerManualLbConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["enabled"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerManualLbConfigEnabled(original["enabled"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerManualLbConfigEnabled(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["asn"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAsn(original["asn"], d, config) |
| transformed["bgp_peer_configs"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigs(original["bgpPeerConfigs"], d, config) |
| transformed["address_pools"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPools(original["addressPools"], d, config) |
| transformed["load_balancer_node_pool_config"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfig(original["loadBalancerNodePoolConfig"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAsn(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| // Handles the string fixed64 format |
| if strVal, ok := v.(string); ok { |
| if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { |
| return intVal |
| } |
| } |
| |
| // number values are represented as float64 |
| if floatVal, ok := v.(float64); ok { |
| intVal := int(floatVal) |
| return intVal |
| } |
| |
| return v // let terraform core handle it otherwise |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigs(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "asn": flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigsAsn(original["asn"], d, config), |
| "ip_address": flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigsIpAddress(original["ipAddress"], d, config), |
| "control_plane_nodes": flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigsControlPlaneNodes(original["controlPlaneNodes"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigsAsn(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| // Handles the string fixed64 format |
| if strVal, ok := v.(string); ok { |
| if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { |
| return intVal |
| } |
| } |
| |
| // number values are represented as float64 |
| if floatVal, ok := v.(float64); ok { |
| intVal := int(floatVal) |
| return intVal |
| } |
| |
| return v // let terraform core handle it otherwise |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigsIpAddress(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigsControlPlaneNodes(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPools(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "pool": flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsPool(original["pool"], d, config), |
| "addresses": flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsAddresses(original["addresses"], d, config), |
| "avoid_buggy_ips": flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsAvoidBuggyIps(original["avoidBuggyIps"], d, config), |
| "manual_assign": flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsManualAssign(original["manualAssign"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsPool(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsAddresses(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsAvoidBuggyIps(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsManualAssign(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["node_pool_config"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfig(original["nodePoolConfig"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["node_configs"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigs(original["nodeConfigs"], d, config) |
| transformed["operating_system"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigOperatingSystem(original["operatingSystem"], d, config) |
| transformed["taints"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaints(original["taints"], d, config) |
| transformed["labels"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigLabels(original["labels"], d, config) |
| transformed["kubelet_config"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfig(original["kubeletConfig"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigs(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "node_ip": flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsNodeIp(original["nodeIp"], d, config), |
| "labels": flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsLabels(original["labels"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsNodeIp(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigOperatingSystem(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaints(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "key": flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsKey(original["key"], d, config), |
| "value": flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsValue(original["value"], d, config), |
| "effect": flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsEffect(original["effect"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsKey(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsValue(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsEffect(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["registry_pull_qps"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfigRegistryPullQps(original["registryPullQps"], d, config) |
| transformed["registry_burst"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfigRegistryBurst(original["registryBurst"], d, config) |
| transformed["serialize_image_pulls_disabled"] = |
| flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfigSerializeImagePullsDisabled(original["serializeImagePullsDisabled"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfigRegistryPullQps(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| // Handles the string fixed64 format |
| if strVal, ok := v.(string); ok { |
| if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { |
| return intVal |
| } |
| } |
| |
| // number values are represented as float64 |
| if floatVal, ok := v.(float64); ok { |
| intVal := int(floatVal) |
| return intVal |
| } |
| |
| return v // let terraform core handle it otherwise |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfigRegistryBurst(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| // Handles the string fixed64 format |
| if strVal, ok := v.(string); ok { |
| if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { |
| return intVal |
| } |
| } |
| |
| // number values are represented as float64 |
| if floatVal, ok := v.(float64); ok { |
| intVal := int(floatVal) |
| return intVal |
| } |
| |
| return v // let terraform core handle it otherwise |
| } |
| |
| func flattenGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfigSerializeImagePullsDisabled(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterStorage(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["lvp_share_config"] = |
| flattenGkeonpremBareMetalClusterStorageLvpShareConfig(original["lvpShareConfig"], d, config) |
| transformed["lvp_node_mounts_config"] = |
| flattenGkeonpremBareMetalClusterStorageLvpNodeMountsConfig(original["lvpNodeMountsConfig"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterStorageLvpShareConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["lvp_config"] = |
| flattenGkeonpremBareMetalClusterStorageLvpShareConfigLvpConfig(original["lvpConfig"], d, config) |
| transformed["shared_path_pv_count"] = |
| flattenGkeonpremBareMetalClusterStorageLvpShareConfigSharedPathPvCount(original["sharedPathPvCount"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterStorageLvpShareConfigLvpConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["path"] = |
| flattenGkeonpremBareMetalClusterStorageLvpShareConfigLvpConfigPath(original["path"], d, config) |
| transformed["storage_class"] = |
| flattenGkeonpremBareMetalClusterStorageLvpShareConfigLvpConfigStorageClass(original["storageClass"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterStorageLvpShareConfigLvpConfigPath(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterStorageLvpShareConfigLvpConfigStorageClass(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterStorageLvpShareConfigSharedPathPvCount(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| // Handles the string fixed64 format |
| if strVal, ok := v.(string); ok { |
| if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { |
| return intVal |
| } |
| } |
| |
| // number values are represented as float64 |
| if floatVal, ok := v.(float64); ok { |
| intVal := int(floatVal) |
| return intVal |
| } |
| |
| return v // let terraform core handle it otherwise |
| } |
| |
| func flattenGkeonpremBareMetalClusterStorageLvpNodeMountsConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["path"] = |
| flattenGkeonpremBareMetalClusterStorageLvpNodeMountsConfigPath(original["path"], d, config) |
| transformed["storage_class"] = |
| flattenGkeonpremBareMetalClusterStorageLvpNodeMountsConfigStorageClass(original["storageClass"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterStorageLvpNodeMountsConfigPath(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterStorageLvpNodeMountsConfigStorageClass(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterProxy(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["uri"] = |
| flattenGkeonpremBareMetalClusterProxyUri(original["uri"], d, config) |
| transformed["no_proxy"] = |
| flattenGkeonpremBareMetalClusterProxyNoProxy(original["noProxy"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterProxyUri(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterProxyNoProxy(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterClusterOperations(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["enable_application_logs"] = |
| flattenGkeonpremBareMetalClusterClusterOperationsEnableApplicationLogs(original["enableApplicationLogs"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterClusterOperationsEnableApplicationLogs(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterMaintenanceConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["maintenance_address_cidr_blocks"] = |
| flattenGkeonpremBareMetalClusterMaintenanceConfigMaintenanceAddressCidrBlocks(original["maintenanceAddressCidrBlocks"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterMaintenanceConfigMaintenanceAddressCidrBlocks(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterNodeConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["max_pods_per_node"] = |
| flattenGkeonpremBareMetalClusterNodeConfigMaxPodsPerNode(original["maxPodsPerNode"], d, config) |
| transformed["container_runtime"] = |
| flattenGkeonpremBareMetalClusterNodeConfigContainerRuntime(original["containerRuntime"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterNodeConfigMaxPodsPerNode(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| // Handles the string fixed64 format |
| if strVal, ok := v.(string); ok { |
| if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { |
| return intVal |
| } |
| } |
| |
| // number values are represented as float64 |
| if floatVal, ok := v.(float64); ok { |
| intVal := int(floatVal) |
| return intVal |
| } |
| |
| return v // let terraform core handle it otherwise |
| } |
| |
| func flattenGkeonpremBareMetalClusterNodeConfigContainerRuntime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterNodeAccessConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["login_user"] = |
| flattenGkeonpremBareMetalClusterNodeAccessConfigLoginUser(original["loginUser"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterNodeAccessConfigLoginUser(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterOsEnvironmentConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["package_repo_excluded"] = |
| flattenGkeonpremBareMetalClusterOsEnvironmentConfigPackageRepoExcluded(original["packageRepoExcluded"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterOsEnvironmentConfigPackageRepoExcluded(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterSecurityConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["authorization"] = |
| flattenGkeonpremBareMetalClusterSecurityConfigAuthorization(original["authorization"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterSecurityConfigAuthorization(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["admin_users"] = |
| flattenGkeonpremBareMetalClusterSecurityConfigAuthorizationAdminUsers(original["adminUsers"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterSecurityConfigAuthorizationAdminUsers(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "username": flattenGkeonpremBareMetalClusterSecurityConfigAuthorizationAdminUsersUsername(original["username"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterSecurityConfigAuthorizationAdminUsersUsername(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterBinaryAuthorization(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["evaluation_mode"] = |
| flattenGkeonpremBareMetalClusterBinaryAuthorizationEvaluationMode(original["evaluationMode"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterBinaryAuthorizationEvaluationMode(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterUpgradePolicy(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["policy"] = |
| flattenGkeonpremBareMetalClusterUpgradePolicyPolicy(original["policy"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterUpgradePolicyPolicy(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterUid(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterState(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterEndpoint(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterReconciling(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterCreateTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterUpdateTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterDeleteTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterLocalName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterEtag(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterFleet(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["membership"] = |
| flattenGkeonpremBareMetalClusterFleetMembership(original["membership"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterFleetMembership(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterStatus(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["error_message"] = |
| flattenGkeonpremBareMetalClusterStatusErrorMessage(original["errorMessage"], d, config) |
| transformed["conditions"] = |
| flattenGkeonpremBareMetalClusterStatusConditions(original["conditions"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterStatusErrorMessage(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterStatusConditions(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "type": flattenGkeonpremBareMetalClusterStatusConditionsType(original["type"], d, config), |
| "reason": flattenGkeonpremBareMetalClusterStatusConditionsReason(original["reason"], d, config), |
| "message": flattenGkeonpremBareMetalClusterStatusConditionsMessage(original["message"], d, config), |
| "last_transition_time": flattenGkeonpremBareMetalClusterStatusConditionsLastTransitionTime(original["lastTransitionTime"], d, config), |
| "state": flattenGkeonpremBareMetalClusterStatusConditionsState(original["state"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterStatusConditionsType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterStatusConditionsReason(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterStatusConditionsMessage(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterStatusConditionsLastTransitionTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterStatusConditionsState(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterValidationCheck(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["options"] = |
| flattenGkeonpremBareMetalClusterValidationCheckOptions(original["options"], d, config) |
| transformed["status"] = |
| flattenGkeonpremBareMetalClusterValidationCheckStatus(original["status"], d, config) |
| transformed["scenario"] = |
| flattenGkeonpremBareMetalClusterValidationCheckScenario(original["scenario"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterValidationCheckOptions(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterValidationCheckStatus(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return nil |
| } |
| original := v.(map[string]interface{}) |
| if len(original) == 0 { |
| return nil |
| } |
| transformed := make(map[string]interface{}) |
| transformed["result"] = |
| flattenGkeonpremBareMetalClusterValidationCheckStatusResult(original["result"], d, config) |
| return []interface{}{transformed} |
| } |
| func flattenGkeonpremBareMetalClusterValidationCheckStatusResult(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| if v == nil { |
| return v |
| } |
| l := v.([]interface{}) |
| transformed := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| original := raw.(map[string]interface{}) |
| if len(original) < 1 { |
| // Do not include empty json objects coming back from the api |
| continue |
| } |
| transformed = append(transformed, map[string]interface{}{ |
| "options": flattenGkeonpremBareMetalClusterValidationCheckStatusResultOptions(original["options"], d, config), |
| "description": flattenGkeonpremBareMetalClusterValidationCheckStatusResultDescription(original["description"], d, config), |
| "category": flattenGkeonpremBareMetalClusterValidationCheckStatusResultCategory(original["category"], d, config), |
| "reason": flattenGkeonpremBareMetalClusterValidationCheckStatusResultReason(original["reason"], d, config), |
| "details": flattenGkeonpremBareMetalClusterValidationCheckStatusResultDetails(original["details"], d, config), |
| }) |
| } |
| return transformed |
| } |
| func flattenGkeonpremBareMetalClusterValidationCheckStatusResultOptions(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterValidationCheckStatusResultDescription(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterValidationCheckStatusResultCategory(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterValidationCheckStatusResultReason(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterValidationCheckStatusResultDetails(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterValidationCheckScenario(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func flattenGkeonpremBareMetalClusterEffectiveAnnotations(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { |
| return v |
| } |
| |
| func expandGkeonpremBareMetalClusterAdminClusterMembership(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterDescription(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterBareMetalVersion(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNetworkConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedIslandModeCidr, err := expandGkeonpremBareMetalClusterNetworkConfigIslandModeCidr(original["island_mode_cidr"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedIslandModeCidr); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["islandModeCidr"] = transformedIslandModeCidr |
| } |
| |
| transformedAdvancedNetworking, err := expandGkeonpremBareMetalClusterNetworkConfigAdvancedNetworking(original["advanced_networking"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedAdvancedNetworking); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["advancedNetworking"] = transformedAdvancedNetworking |
| } |
| |
| transformedMultipleNetworkInterfacesConfig, err := expandGkeonpremBareMetalClusterNetworkConfigMultipleNetworkInterfacesConfig(original["multiple_network_interfaces_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedMultipleNetworkInterfacesConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["multipleNetworkInterfacesConfig"] = transformedMultipleNetworkInterfacesConfig |
| } |
| |
| transformedSrIovConfig, err := expandGkeonpremBareMetalClusterNetworkConfigSrIovConfig(original["sr_iov_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedSrIovConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["srIovConfig"] = transformedSrIovConfig |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNetworkConfigIslandModeCidr(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedServiceAddressCidrBlocks, err := expandGkeonpremBareMetalClusterNetworkConfigIslandModeCidrServiceAddressCidrBlocks(original["service_address_cidr_blocks"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedServiceAddressCidrBlocks); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["serviceAddressCidrBlocks"] = transformedServiceAddressCidrBlocks |
| } |
| |
| transformedPodAddressCidrBlocks, err := expandGkeonpremBareMetalClusterNetworkConfigIslandModeCidrPodAddressCidrBlocks(original["pod_address_cidr_blocks"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedPodAddressCidrBlocks); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["podAddressCidrBlocks"] = transformedPodAddressCidrBlocks |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNetworkConfigIslandModeCidrServiceAddressCidrBlocks(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNetworkConfigIslandModeCidrPodAddressCidrBlocks(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNetworkConfigAdvancedNetworking(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNetworkConfigMultipleNetworkInterfacesConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedEnabled, err := expandGkeonpremBareMetalClusterNetworkConfigMultipleNetworkInterfacesConfigEnabled(original["enabled"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedEnabled); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["enabled"] = transformedEnabled |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNetworkConfigMultipleNetworkInterfacesConfigEnabled(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNetworkConfigSrIovConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedEnabled, err := expandGkeonpremBareMetalClusterNetworkConfigSrIovConfigEnabled(original["enabled"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedEnabled); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["enabled"] = transformedEnabled |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNetworkConfigSrIovConfigEnabled(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlane(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedControlPlaneNodePoolConfig, err := expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfig(original["control_plane_node_pool_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedControlPlaneNodePoolConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["controlPlaneNodePoolConfig"] = transformedControlPlaneNodePoolConfig |
| } |
| |
| transformedApiServerArgs, err := expandGkeonpremBareMetalClusterControlPlaneApiServerArgs(original["api_server_args"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedApiServerArgs); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["apiServerArgs"] = transformedApiServerArgs |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedNodePoolConfig, err := expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfig(original["node_pool_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedNodePoolConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["nodePoolConfig"] = transformedNodePoolConfig |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedNodeConfigs, err := expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigNodeConfigs(original["node_configs"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedNodeConfigs); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["nodeConfigs"] = transformedNodeConfigs |
| } |
| |
| transformedOperatingSystem, err := expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigOperatingSystem(original["operating_system"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedOperatingSystem); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["operatingSystem"] = transformedOperatingSystem |
| } |
| |
| transformedTaints, err := expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaints(original["taints"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedTaints); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["taints"] = transformedTaints |
| } |
| |
| transformedLabels, err := expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigLabels(original["labels"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedLabels); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["labels"] = transformedLabels |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigNodeConfigs(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| req := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| if raw == nil { |
| continue |
| } |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedNodeIp, err := expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigNodeConfigsNodeIp(original["node_ip"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedNodeIp); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["nodeIp"] = transformedNodeIp |
| } |
| |
| transformedLabels, err := expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigNodeConfigsLabels(original["labels"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedLabels); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["labels"] = transformedLabels |
| } |
| |
| req = append(req, transformed) |
| } |
| return req, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigNodeConfigsNodeIp(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigNodeConfigsLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) { |
| if v == nil { |
| return map[string]string{}, nil |
| } |
| m := make(map[string]string) |
| for k, val := range v.(map[string]interface{}) { |
| m[k] = val.(string) |
| } |
| return m, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigOperatingSystem(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaints(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| req := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| if raw == nil { |
| continue |
| } |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedKey, err := expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaintsKey(original["key"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedKey); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["key"] = transformedKey |
| } |
| |
| transformedValue, err := expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaintsValue(original["value"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedValue); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["value"] = transformedValue |
| } |
| |
| transformedEffect, err := expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaintsEffect(original["effect"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedEffect); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["effect"] = transformedEffect |
| } |
| |
| req = append(req, transformed) |
| } |
| return req, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaintsKey(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaintsValue(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigTaintsEffect(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneControlPlaneNodePoolConfigNodePoolConfigLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) { |
| if v == nil { |
| return map[string]string{}, nil |
| } |
| m := make(map[string]string) |
| for k, val := range v.(map[string]interface{}) { |
| m[k] = val.(string) |
| } |
| return m, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneApiServerArgs(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| req := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| if raw == nil { |
| continue |
| } |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedArgument, err := expandGkeonpremBareMetalClusterControlPlaneApiServerArgsArgument(original["argument"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedArgument); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["argument"] = transformedArgument |
| } |
| |
| transformedValue, err := expandGkeonpremBareMetalClusterControlPlaneApiServerArgsValue(original["value"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedValue); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["value"] = transformedValue |
| } |
| |
| req = append(req, transformed) |
| } |
| return req, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneApiServerArgsArgument(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterControlPlaneApiServerArgsValue(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancer(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedVipConfig, err := expandGkeonpremBareMetalClusterLoadBalancerVipConfig(original["vip_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedVipConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["vipConfig"] = transformedVipConfig |
| } |
| |
| transformedPortConfig, err := expandGkeonpremBareMetalClusterLoadBalancerPortConfig(original["port_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedPortConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["portConfig"] = transformedPortConfig |
| } |
| |
| transformedMetalLbConfig, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfig(original["metal_lb_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedMetalLbConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["metalLbConfig"] = transformedMetalLbConfig |
| } |
| |
| transformedManualLbConfig, err := expandGkeonpremBareMetalClusterLoadBalancerManualLbConfig(original["manual_lb_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedManualLbConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["manualLbConfig"] = transformedManualLbConfig |
| } |
| |
| transformedBgpLbConfig, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfig(original["bgp_lb_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedBgpLbConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["bgpLbConfig"] = transformedBgpLbConfig |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerVipConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedControlPlaneVip, err := expandGkeonpremBareMetalClusterLoadBalancerVipConfigControlPlaneVip(original["control_plane_vip"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedControlPlaneVip); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["controlPlaneVip"] = transformedControlPlaneVip |
| } |
| |
| transformedIngressVip, err := expandGkeonpremBareMetalClusterLoadBalancerVipConfigIngressVip(original["ingress_vip"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedIngressVip); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["ingressVip"] = transformedIngressVip |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerVipConfigControlPlaneVip(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerVipConfigIngressVip(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerPortConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedControlPlaneLoadBalancerPort, err := expandGkeonpremBareMetalClusterLoadBalancerPortConfigControlPlaneLoadBalancerPort(original["control_plane_load_balancer_port"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedControlPlaneLoadBalancerPort); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["controlPlaneLoadBalancerPort"] = transformedControlPlaneLoadBalancerPort |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerPortConfigControlPlaneLoadBalancerPort(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedAddressPools, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPools(original["address_pools"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedAddressPools); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["addressPools"] = transformedAddressPools |
| } |
| |
| transformedLoadBalancerNodePoolConfig, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfig(original["load_balancer_node_pool_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedLoadBalancerNodePoolConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["loadBalancerNodePoolConfig"] = transformedLoadBalancerNodePoolConfig |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPools(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| req := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| if raw == nil { |
| continue |
| } |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedPool, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsPool(original["pool"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedPool); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["pool"] = transformedPool |
| } |
| |
| transformedAddresses, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsAddresses(original["addresses"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedAddresses); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["addresses"] = transformedAddresses |
| } |
| |
| transformedAvoidBuggyIps, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsAvoidBuggyIps(original["avoid_buggy_ips"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedAvoidBuggyIps); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["avoidBuggyIps"] = transformedAvoidBuggyIps |
| } |
| |
| transformedManualAssign, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsManualAssign(original["manual_assign"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedManualAssign); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["manualAssign"] = transformedManualAssign |
| } |
| |
| req = append(req, transformed) |
| } |
| return req, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsPool(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsAddresses(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsAvoidBuggyIps(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigAddressPoolsManualAssign(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedNodePoolConfig, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfig(original["node_pool_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedNodePoolConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["nodePoolConfig"] = transformedNodePoolConfig |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedNodeConfigs, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigs(original["node_configs"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedNodeConfigs); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["nodeConfigs"] = transformedNodeConfigs |
| } |
| |
| transformedOperatingSystem, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigOperatingSystem(original["operating_system"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedOperatingSystem); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["operatingSystem"] = transformedOperatingSystem |
| } |
| |
| transformedTaints, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaints(original["taints"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedTaints); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["taints"] = transformedTaints |
| } |
| |
| transformedLabels, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigLabels(original["labels"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedLabels); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["labels"] = transformedLabels |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigs(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| req := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| if raw == nil { |
| continue |
| } |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedNodeIp, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsNodeIp(original["node_ip"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedNodeIp); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["nodeIp"] = transformedNodeIp |
| } |
| |
| transformedLabels, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsLabels(original["labels"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedLabels); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["labels"] = transformedLabels |
| } |
| |
| req = append(req, transformed) |
| } |
| return req, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsNodeIp(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) { |
| if v == nil { |
| return map[string]string{}, nil |
| } |
| m := make(map[string]string) |
| for k, val := range v.(map[string]interface{}) { |
| m[k] = val.(string) |
| } |
| return m, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigOperatingSystem(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaints(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| req := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| if raw == nil { |
| continue |
| } |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedKey, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsKey(original["key"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedKey); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["key"] = transformedKey |
| } |
| |
| transformedValue, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsValue(original["value"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedValue); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["value"] = transformedValue |
| } |
| |
| transformedEffect, err := expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsEffect(original["effect"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedEffect); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["effect"] = transformedEffect |
| } |
| |
| req = append(req, transformed) |
| } |
| return req, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsKey(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsValue(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsEffect(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerMetalLbConfigLoadBalancerNodePoolConfigNodePoolConfigLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) { |
| if v == nil { |
| return map[string]string{}, nil |
| } |
| m := make(map[string]string) |
| for k, val := range v.(map[string]interface{}) { |
| m[k] = val.(string) |
| } |
| return m, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerManualLbConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedEnabled, err := expandGkeonpremBareMetalClusterLoadBalancerManualLbConfigEnabled(original["enabled"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedEnabled); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["enabled"] = transformedEnabled |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerManualLbConfigEnabled(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedAsn, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAsn(original["asn"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedAsn); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["asn"] = transformedAsn |
| } |
| |
| transformedBgpPeerConfigs, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigs(original["bgp_peer_configs"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedBgpPeerConfigs); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["bgpPeerConfigs"] = transformedBgpPeerConfigs |
| } |
| |
| transformedAddressPools, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPools(original["address_pools"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedAddressPools); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["addressPools"] = transformedAddressPools |
| } |
| |
| transformedLoadBalancerNodePoolConfig, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfig(original["load_balancer_node_pool_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedLoadBalancerNodePoolConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["loadBalancerNodePoolConfig"] = transformedLoadBalancerNodePoolConfig |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAsn(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigs(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| req := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| if raw == nil { |
| continue |
| } |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedAsn, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigsAsn(original["asn"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedAsn); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["asn"] = transformedAsn |
| } |
| |
| transformedIpAddress, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigsIpAddress(original["ip_address"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedIpAddress); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["ipAddress"] = transformedIpAddress |
| } |
| |
| transformedControlPlaneNodes, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigsControlPlaneNodes(original["control_plane_nodes"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedControlPlaneNodes); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["controlPlaneNodes"] = transformedControlPlaneNodes |
| } |
| |
| req = append(req, transformed) |
| } |
| return req, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigsAsn(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigsIpAddress(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigBgpPeerConfigsControlPlaneNodes(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPools(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| req := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| if raw == nil { |
| continue |
| } |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedPool, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsPool(original["pool"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedPool); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["pool"] = transformedPool |
| } |
| |
| transformedAddresses, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsAddresses(original["addresses"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedAddresses); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["addresses"] = transformedAddresses |
| } |
| |
| transformedAvoidBuggyIps, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsAvoidBuggyIps(original["avoid_buggy_ips"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedAvoidBuggyIps); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["avoidBuggyIps"] = transformedAvoidBuggyIps |
| } |
| |
| transformedManualAssign, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsManualAssign(original["manual_assign"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedManualAssign); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["manualAssign"] = transformedManualAssign |
| } |
| |
| req = append(req, transformed) |
| } |
| return req, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsPool(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsAddresses(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsAvoidBuggyIps(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigAddressPoolsManualAssign(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedNodePoolConfig, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfig(original["node_pool_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedNodePoolConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["nodePoolConfig"] = transformedNodePoolConfig |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedNodeConfigs, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigs(original["node_configs"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedNodeConfigs); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["nodeConfigs"] = transformedNodeConfigs |
| } |
| |
| transformedOperatingSystem, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigOperatingSystem(original["operating_system"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedOperatingSystem); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["operatingSystem"] = transformedOperatingSystem |
| } |
| |
| transformedTaints, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaints(original["taints"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedTaints); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["taints"] = transformedTaints |
| } |
| |
| transformedLabels, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigLabels(original["labels"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedLabels); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["labels"] = transformedLabels |
| } |
| |
| transformedKubeletConfig, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfig(original["kubelet_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedKubeletConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["kubeletConfig"] = transformedKubeletConfig |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigs(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| req := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| if raw == nil { |
| continue |
| } |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedNodeIp, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsNodeIp(original["node_ip"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedNodeIp); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["nodeIp"] = transformedNodeIp |
| } |
| |
| transformedLabels, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsLabels(original["labels"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedLabels); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["labels"] = transformedLabels |
| } |
| |
| req = append(req, transformed) |
| } |
| return req, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsNodeIp(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigNodeConfigsLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) { |
| if v == nil { |
| return map[string]string{}, nil |
| } |
| m := make(map[string]string) |
| for k, val := range v.(map[string]interface{}) { |
| m[k] = val.(string) |
| } |
| return m, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigOperatingSystem(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaints(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| req := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| if raw == nil { |
| continue |
| } |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedKey, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsKey(original["key"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedKey); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["key"] = transformedKey |
| } |
| |
| transformedValue, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsValue(original["value"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedValue); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["value"] = transformedValue |
| } |
| |
| transformedEffect, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsEffect(original["effect"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedEffect); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["effect"] = transformedEffect |
| } |
| |
| req = append(req, transformed) |
| } |
| return req, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsKey(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsValue(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigTaintsEffect(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) { |
| if v == nil { |
| return map[string]string{}, nil |
| } |
| m := make(map[string]string) |
| for k, val := range v.(map[string]interface{}) { |
| m[k] = val.(string) |
| } |
| return m, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedRegistryPullQps, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfigRegistryPullQps(original["registry_pull_qps"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedRegistryPullQps); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["registryPullQps"] = transformedRegistryPullQps |
| } |
| |
| transformedRegistryBurst, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfigRegistryBurst(original["registry_burst"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedRegistryBurst); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["registryBurst"] = transformedRegistryBurst |
| } |
| |
| transformedSerializeImagePullsDisabled, err := expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfigSerializeImagePullsDisabled(original["serialize_image_pulls_disabled"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedSerializeImagePullsDisabled); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["serializeImagePullsDisabled"] = transformedSerializeImagePullsDisabled |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfigRegistryPullQps(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfigRegistryBurst(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterLoadBalancerBgpLbConfigLoadBalancerNodePoolConfigNodePoolConfigKubeletConfigSerializeImagePullsDisabled(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterStorage(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedLvpShareConfig, err := expandGkeonpremBareMetalClusterStorageLvpShareConfig(original["lvp_share_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedLvpShareConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["lvpShareConfig"] = transformedLvpShareConfig |
| } |
| |
| transformedLvpNodeMountsConfig, err := expandGkeonpremBareMetalClusterStorageLvpNodeMountsConfig(original["lvp_node_mounts_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedLvpNodeMountsConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["lvpNodeMountsConfig"] = transformedLvpNodeMountsConfig |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterStorageLvpShareConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedLvpConfig, err := expandGkeonpremBareMetalClusterStorageLvpShareConfigLvpConfig(original["lvp_config"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedLvpConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["lvpConfig"] = transformedLvpConfig |
| } |
| |
| transformedSharedPathPvCount, err := expandGkeonpremBareMetalClusterStorageLvpShareConfigSharedPathPvCount(original["shared_path_pv_count"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedSharedPathPvCount); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["sharedPathPvCount"] = transformedSharedPathPvCount |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterStorageLvpShareConfigLvpConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedPath, err := expandGkeonpremBareMetalClusterStorageLvpShareConfigLvpConfigPath(original["path"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedPath); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["path"] = transformedPath |
| } |
| |
| transformedStorageClass, err := expandGkeonpremBareMetalClusterStorageLvpShareConfigLvpConfigStorageClass(original["storage_class"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedStorageClass); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["storageClass"] = transformedStorageClass |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterStorageLvpShareConfigLvpConfigPath(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterStorageLvpShareConfigLvpConfigStorageClass(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterStorageLvpShareConfigSharedPathPvCount(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterStorageLvpNodeMountsConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedPath, err := expandGkeonpremBareMetalClusterStorageLvpNodeMountsConfigPath(original["path"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedPath); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["path"] = transformedPath |
| } |
| |
| transformedStorageClass, err := expandGkeonpremBareMetalClusterStorageLvpNodeMountsConfigStorageClass(original["storage_class"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedStorageClass); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["storageClass"] = transformedStorageClass |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterStorageLvpNodeMountsConfigPath(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterStorageLvpNodeMountsConfigStorageClass(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterProxy(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedUri, err := expandGkeonpremBareMetalClusterProxyUri(original["uri"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedUri); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["uri"] = transformedUri |
| } |
| |
| transformedNoProxy, err := expandGkeonpremBareMetalClusterProxyNoProxy(original["no_proxy"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedNoProxy); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["noProxy"] = transformedNoProxy |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterProxyUri(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterProxyNoProxy(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterClusterOperations(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedEnableApplicationLogs, err := expandGkeonpremBareMetalClusterClusterOperationsEnableApplicationLogs(original["enable_application_logs"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedEnableApplicationLogs); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["enableApplicationLogs"] = transformedEnableApplicationLogs |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterClusterOperationsEnableApplicationLogs(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterMaintenanceConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedMaintenanceAddressCidrBlocks, err := expandGkeonpremBareMetalClusterMaintenanceConfigMaintenanceAddressCidrBlocks(original["maintenance_address_cidr_blocks"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedMaintenanceAddressCidrBlocks); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["maintenanceAddressCidrBlocks"] = transformedMaintenanceAddressCidrBlocks |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterMaintenanceConfigMaintenanceAddressCidrBlocks(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNodeConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedMaxPodsPerNode, err := expandGkeonpremBareMetalClusterNodeConfigMaxPodsPerNode(original["max_pods_per_node"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedMaxPodsPerNode); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["maxPodsPerNode"] = transformedMaxPodsPerNode |
| } |
| |
| transformedContainerRuntime, err := expandGkeonpremBareMetalClusterNodeConfigContainerRuntime(original["container_runtime"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedContainerRuntime); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["containerRuntime"] = transformedContainerRuntime |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNodeConfigMaxPodsPerNode(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNodeConfigContainerRuntime(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNodeAccessConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedLoginUser, err := expandGkeonpremBareMetalClusterNodeAccessConfigLoginUser(original["login_user"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedLoginUser); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["loginUser"] = transformedLoginUser |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterNodeAccessConfigLoginUser(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterOsEnvironmentConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedPackageRepoExcluded, err := expandGkeonpremBareMetalClusterOsEnvironmentConfigPackageRepoExcluded(original["package_repo_excluded"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedPackageRepoExcluded); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["packageRepoExcluded"] = transformedPackageRepoExcluded |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterOsEnvironmentConfigPackageRepoExcluded(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterSecurityConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedAuthorization, err := expandGkeonpremBareMetalClusterSecurityConfigAuthorization(original["authorization"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedAuthorization); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["authorization"] = transformedAuthorization |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterSecurityConfigAuthorization(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedAdminUsers, err := expandGkeonpremBareMetalClusterSecurityConfigAuthorizationAdminUsers(original["admin_users"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedAdminUsers); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["adminUsers"] = transformedAdminUsers |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterSecurityConfigAuthorizationAdminUsers(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| req := make([]interface{}, 0, len(l)) |
| for _, raw := range l { |
| if raw == nil { |
| continue |
| } |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedUsername, err := expandGkeonpremBareMetalClusterSecurityConfigAuthorizationAdminUsersUsername(original["username"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedUsername); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["username"] = transformedUsername |
| } |
| |
| req = append(req, transformed) |
| } |
| return req, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterSecurityConfigAuthorizationAdminUsersUsername(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterBinaryAuthorization(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedEvaluationMode, err := expandGkeonpremBareMetalClusterBinaryAuthorizationEvaluationMode(original["evaluation_mode"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedEvaluationMode); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["evaluationMode"] = transformedEvaluationMode |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterBinaryAuthorizationEvaluationMode(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterUpgradePolicy(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| l := v.([]interface{}) |
| if len(l) == 0 || l[0] == nil { |
| return nil, nil |
| } |
| raw := l[0] |
| original := raw.(map[string]interface{}) |
| transformed := make(map[string]interface{}) |
| |
| transformedPolicy, err := expandGkeonpremBareMetalClusterUpgradePolicyPolicy(original["policy"], d, config) |
| if err != nil { |
| return nil, err |
| } else if val := reflect.ValueOf(transformedPolicy); val.IsValid() && !tpgresource.IsEmptyValue(val) { |
| transformed["policy"] = transformedPolicy |
| } |
| |
| return transformed, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterUpgradePolicyPolicy(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { |
| return v, nil |
| } |
| |
| func expandGkeonpremBareMetalClusterEffectiveAnnotations(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) { |
| if v == nil { |
| return map[string]string{}, nil |
| } |
| m := make(map[string]string) |
| for k, val := range v.(map[string]interface{}) { |
| m[k] = val.(string) |
| } |
| return m, nil |
| } |