<p>I am trying to automate the deployment of my Zonal Private GKE Cluster.
I have the following error when deploying:</p>

<pre><code>ci-qa: {"ResourceType":"gcp-types/container-v1beta1:projects.zones.clusters","ResourceErrorCode":"400","ResourceErrorMessage":{"code":400,"message":"'zone' field cannot be used to access GKE regional clusters. Use 'name' or 'parent' fields instead.","status":"INVALID_ARGUMENT","statusMessage":"Bad Request","requestPath":"https://container.googleapis.com/v1beta1/projects/YYZ/zones/europe-west2/clusters","httpMethod":"POST"}}
</code></pre>

<p>Which I don't understand based on my config file:</p>

<pre class="lang-yaml prettyprint-override"><code>imports:
- path: python/kubernetes_engine_private_zonal_cluster.py
  name: kubernetes_engine_private_zonal_cluster.py
- path: python/kubernetes_engine_apis.py
  name: kubernetes_engine_apis.py

resources:
- name: cluster
  type: kubernetes_engine_private_zonal_cluster.py
  properties:
    CLUSTER_NAME: ci-qa
    CLUSTER_ZONE: europe-west2
    NUM_NODES: 3
    CLUSTER_SERVICESIPV4CIDRBLOCK: 172.17.0.0/16
    CLUSTER_NETWORK: vpc1-priv
    CLUSTER_CLUSTERIPV4CIDR: 172.16.0.0/16
    CLUSTER_SUBNETWORK: vpc1-priv-euwe1-1
    CLUSTER_MACHINE_TYPE: n1-standard-4
    CLUSTER_VERSION: 1.10.7-gke.1

- name: types
  type: kubernetes_engine_apis.py
  properties:
    endpoint: $(ref.cluster.endpoint)
</code></pre>

<p>And based on the template file</p>

<pre class="lang-python prettyprint-override"><code>def GenerateConfig(context):
'""Generate YAML resource configuration.""'

cluster_name = context.properties['CLUSTER_NAME']
cluster_zone = context.properties['CLUSTER_ZONE']
number_of_nodes = context.properties['NUM_NODES']
cluster_servicesIpv4CidrBlock = context.properties['CLUSTER_SERVICESIPV4CIDRBLOCK']
cluster_network = context.properties['CLUSTER_NETWORK']
cluster_clusterIpv4Cidr = context.properties['CLUSTER_CLUSTERIPV4CIDR']
cluster_subnetwork = context.properties['CLUSTER_SUBNETWORK']
cluster_machine_type = context.properties['CLUSTER_MACHINE_TYPE']
cluster_version = context.properties['CLUSTER_VERSION']

resources = []
outputs = []

resources.append({
    'name': cluster_name,
    'type': 'gcp-types/container-v1beta1:projects.zones.clusters',
    'properties': {
        'zone': cluster_zone,
        'cluster': {
            'name': cluster_name,
            'description': 'Private Cluster',
            'initialNodeCount': number_of_nodes,
            'initialClusterVersion': cluster_version,
            'privateCluster': True,
            'loggingService': 'logging.googleapis.com',
            'monitoringService': 'monitoring.googleapis.com',
            'network': cluster_network,
            'clusterIpv4Cidr': cluster_clusterIpv4Cidr,
            'subnetwork': cluster_subnetwork,
            'nodeConfig': {
                'oauthScopes': [
                    'https://www.googleapis.com/auth/' + scope
                    for scope in [
                        'compute',
                        'devstorage.read_only',
                        'logging.write',
                        'monitoring'
                    ]
                ],
                'machineType': cluster_machine_type,
                'imageType': 'COS',
                'preemptible': True
            },
            # 'nodePools': {
            #     'name': 'test',
            #     'initialNodeCount': number_of_nodes,
            #     'oauthScopes': [
            #         'https://www.googleapis.com/auth/' + scope
            #         for scope in [
            #             'compute',
            #             'devstorage.read_only',
            #             'logging.write',
            #             'monitoring'
            #         ]
            #     ],
            #     'machineType': cluster_machine_type,
            #     'imageType': 'COS'
            # },
            'ipAllocationPolicy': {
                'useIpAliases': True,
                'createSubnetwork': False,
                'servicesIpv4CidrBlock': cluster_servicesIpv4CidrBlock
            }
        }
    }
})
outputs.append({
    'name': 'endpoint',
    'value': '$(ref.' + cluster_name + '.endpoint)'
})
return {'resources': resources, 'outputs': outputs}
</code></pre>

<p>and based on the GCP documentation.</p>

<p>Any idea where I did a mistake?</p>

<p>I cannnot find any example of such Deployment MAnager either in Google examples, either somewhere else.</p>

<p>Thanks for any feedback!</p>

Indigo Ping
<p>You are only specifying a region: <code>CLUSTER_ZONE: europe-west2</code>.</p>

<p>Try adding the desired zone, e.g. <code>CLUSTER_ZONE: europe-west2-b</code></p>
