in tfplan2cai/converters/google/resources/services/container/container.go [123:308]
func GetContainerClusterApiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]interface{}, error) {
obj := make(map[string]interface{})
enableKubernetesAlphaProp, err := expandContainerClusterEnableKubernetesAlpha(d.Get("enable_kubernetes_alpha"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("enable_kubernetes_alpha"); !tpgresource.IsEmptyValue(reflect.ValueOf(enableKubernetesAlphaProp)) && (ok || !reflect.DeepEqual(v, enableKubernetesAlphaProp)) {
obj["enableKubernetesAlpha"] = enableKubernetesAlphaProp
}
nameProp, err := expandContainerClusterName(d.Get("name"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("name"); !tpgresource.IsEmptyValue(reflect.ValueOf(nameProp)) && (ok || !reflect.DeepEqual(v, nameProp)) {
obj["name"] = nameProp
}
descriptionProp, err := expandContainerClusterDescription(d.Get("description"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("description"); !tpgresource.IsEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
obj["description"] = descriptionProp
}
initialNodeCountProp, err := expandContainerClusterInitialNodeCount(d.Get("initial_node_count"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("initial_node_count"); !tpgresource.IsEmptyValue(reflect.ValueOf(initialNodeCountProp)) && (ok || !reflect.DeepEqual(v, initialNodeCountProp)) {
obj["initialNodeCount"] = initialNodeCountProp
}
nodeConfigProp, err := expandContainerClusterNodeConfig(d.Get("node_config"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("node_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(nodeConfigProp)) && (ok || !reflect.DeepEqual(v, nodeConfigProp)) {
obj["nodeConfig"] = nodeConfigProp
}
masterAuthProp, err := expandContainerClusterMasterAuth(d.Get("master_auth"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("master_auth"); !tpgresource.IsEmptyValue(reflect.ValueOf(masterAuthProp)) && (ok || !reflect.DeepEqual(v, masterAuthProp)) {
obj["masterAuth"] = masterAuthProp
}
loggingServiceProp, err := expandContainerClusterLoggingService(d.Get("logging_service"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("logging_service"); !tpgresource.IsEmptyValue(reflect.ValueOf(loggingServiceProp)) && (ok || !reflect.DeepEqual(v, loggingServiceProp)) {
obj["loggingService"] = loggingServiceProp
}
monitoringServiceProp, err := expandContainerClusterMonitoringService(d.Get("monitoring_service"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("monitoring_service"); !tpgresource.IsEmptyValue(reflect.ValueOf(monitoringServiceProp)) && (ok || !reflect.DeepEqual(v, monitoringServiceProp)) {
obj["monitoringService"] = monitoringServiceProp
}
networkProp, err := expandContainerClusterNetwork(d.Get("network"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("network"); !tpgresource.IsEmptyValue(reflect.ValueOf(networkProp)) && (ok || !reflect.DeepEqual(v, networkProp)) {
obj["network"] = networkProp
}
privateClusterConfigProp, err := expandContainerClusterPrivateClusterConfig(d.Get("private_cluster_config"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("private_cluster_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(privateClusterConfigProp)) && (ok || !reflect.DeepEqual(v, privateClusterConfigProp)) {
obj["privateClusterConfig"] = privateClusterConfigProp
}
workloadIdentityConfigProp, err := expandContainerClusterWorkloadIdentityConfig(d.Get("workload_identity_config"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("workload_identity_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(workloadIdentityConfigProp)) && (ok || !reflect.DeepEqual(v, workloadIdentityConfigProp)) {
obj["workloadIdentityConfig"] = workloadIdentityConfigProp
}
clusterIpv4CidrProp, err := expandContainerClusterClusterIpv4Cidr(d.Get("cluster_ipv4_cidr"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("cluster_ipv4_cidr"); !tpgresource.IsEmptyValue(reflect.ValueOf(clusterIpv4CidrProp)) && (ok || !reflect.DeepEqual(v, clusterIpv4CidrProp)) {
obj["clusterIpv4Cidr"] = clusterIpv4CidrProp
}
addonsConfigProp, err := expandContainerClusterAddonsConfig(d.Get("addons_config"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("addons_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(addonsConfigProp)) && (ok || !reflect.DeepEqual(v, addonsConfigProp)) {
obj["addonsConfig"] = addonsConfigProp
}
subnetworkProp, err := expandContainerClusterSubnetwork(d.Get("subnetwork"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("subnetwork"); !tpgresource.IsEmptyValue(reflect.ValueOf(subnetworkProp)) && (ok || !reflect.DeepEqual(v, subnetworkProp)) {
obj["subnetwork"] = subnetworkProp
}
locationsProp, err := expandContainerClusterNodeLocations(d.Get("node_locations"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("node_locations"); !tpgresource.IsEmptyValue(reflect.ValueOf(locationsProp)) && (ok || !reflect.DeepEqual(v, locationsProp)) {
obj["locations"] = locationsProp
}
resourceLabelsProp, err := expandContainerClusterResourceLabels(d.Get("resource_labels"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("resource_labels"); !tpgresource.IsEmptyValue(reflect.ValueOf(resourceLabelsProp)) && (ok || !reflect.DeepEqual(v, resourceLabelsProp)) {
obj["resourceLabels"] = resourceLabelsProp
}
labelFingerprintProp, err := expandContainerClusterLabelFingerprint(d.Get("label_fingerprint"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("label_fingerprint"); !tpgresource.IsEmptyValue(reflect.ValueOf(labelFingerprintProp)) && (ok || !reflect.DeepEqual(v, labelFingerprintProp)) {
obj["labelFingerprint"] = labelFingerprintProp
}
legacyAbacProp, err := expandContainerClusterEnableLegacyAbac(d.Get("enable_legacy_abac"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("enable_legacy_abac"); !tpgresource.IsEmptyValue(reflect.ValueOf(legacyAbacProp)) && (ok || !reflect.DeepEqual(v, legacyAbacProp)) {
obj["legacyAbac"] = legacyAbacProp
}
networkPolicyProp, err := expandContainerClusterNetworkPolicy(d.Get("network_policy"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("network_policy"); !tpgresource.IsEmptyValue(reflect.ValueOf(networkPolicyProp)) && (ok || !reflect.DeepEqual(v, networkPolicyProp)) {
obj["networkPolicy"] = networkPolicyProp
}
defaultMaxPodsConstraintProp, err := expandContainerClusterDefaultMaxPodsPerNode(d.Get("default_max_pods_per_node"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("default_max_pods_per_node"); !tpgresource.IsEmptyValue(reflect.ValueOf(defaultMaxPodsConstraintProp)) && (ok || !reflect.DeepEqual(v, defaultMaxPodsConstraintProp)) {
obj["defaultMaxPodsConstraint"] = defaultMaxPodsConstraintProp
}
ipAllocationPolicyProp, err := expandContainerClusterIpAllocationPolicy(d.Get("ip_allocation_policy"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("ip_allocation_policy"); !tpgresource.IsEmptyValue(reflect.ValueOf(ipAllocationPolicyProp)) && (ok || !reflect.DeepEqual(v, ipAllocationPolicyProp)) {
obj["ipAllocationPolicy"] = ipAllocationPolicyProp
}
initialClusterVersionProp, err := expandContainerClusterMinMasterVersion(d.Get("min_master_version"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("min_master_version"); !tpgresource.IsEmptyValue(reflect.ValueOf(initialClusterVersionProp)) && (ok || !reflect.DeepEqual(v, initialClusterVersionProp)) {
obj["initialClusterVersion"] = initialClusterVersionProp
}
enableTpuProp, err := expandContainerClusterEnableTpu(d.Get("enable_tpu"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("enable_tpu"); !tpgresource.IsEmptyValue(reflect.ValueOf(enableTpuProp)) && (ok || !reflect.DeepEqual(v, enableTpuProp)) {
obj["enableTpu"] = enableTpuProp
}
tpuIpv4CidrBlockProp, err := expandContainerClusterTPUIpv4CidrBlock(d.Get("tpu_ipv4_cidr_block"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("tpu_ipv4_cidr_block"); !tpgresource.IsEmptyValue(reflect.ValueOf(tpuIpv4CidrBlockProp)) && (ok || !reflect.DeepEqual(v, tpuIpv4CidrBlockProp)) {
obj["tpuIpv4CidrBlock"] = tpuIpv4CidrBlockProp
}
masterAuthorizedNetworksConfigProp, err := expandContainerClusterMasterAuthorizedNetworksConfig(d.Get("master_authorized_networks_config"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("master_authorized_networks_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(masterAuthorizedNetworksConfigProp)) && (ok || !reflect.DeepEqual(v, masterAuthorizedNetworksConfigProp)) {
obj["masterAuthorizedNetworksConfig"] = masterAuthorizedNetworksConfigProp
}
locationProp, err := expandContainerClusterLocation(d.Get("location"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("location"); !tpgresource.IsEmptyValue(reflect.ValueOf(locationProp)) && (ok || !reflect.DeepEqual(v, locationProp)) {
obj["location"] = locationProp
}
kubectlPathProp, err := expandContainerClusterKubectlPath(d.Get("kubectl_path"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("kubectl_path"); !tpgresource.IsEmptyValue(reflect.ValueOf(kubectlPathProp)) && (ok || !reflect.DeepEqual(v, kubectlPathProp)) {
obj["kubectlPath"] = kubectlPathProp
}
kubectlContextProp, err := expandContainerClusterKubectlContext(d.Get("kubectl_context"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("kubectl_context"); !tpgresource.IsEmptyValue(reflect.ValueOf(kubectlContextProp)) && (ok || !reflect.DeepEqual(v, kubectlContextProp)) {
obj["kubectlContext"] = kubectlContextProp
}
databaseEncryptionProp, err := expandContainerClusterDatabaseEncryption(d.Get("database_encryption"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("database_encryption"); !tpgresource.IsEmptyValue(reflect.ValueOf(databaseEncryptionProp)) && (ok || !reflect.DeepEqual(v, databaseEncryptionProp)) {
obj["databaseEncryption"] = databaseEncryptionProp
}
releaseChannelProp, err := expandContainerClusterReleaseChannel(d.Get("release_channel"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("release_channel"); !tpgresource.IsEmptyValue(reflect.ValueOf(releaseChannelProp)) && (ok || !reflect.DeepEqual(v, releaseChannelProp)) {
obj["releaseChannel"] = releaseChannelProp
}
return obj, nil
}