Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcp_compute_backend_service not creating regional backend services #52319

Closed
kloeffler opened this issue Feb 15, 2019 · 6 comments
Closed

gcp_compute_backend_service not creating regional backend services #52319

kloeffler opened this issue Feb 15, 2019 · 6 comments
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bot_closed bug This issue/PR relates to a bug. cloud collection:google.cloud collection Related to Ansible Collections work gce module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.

Comments

@kloeffler
Copy link

SUMMARY

gcp_compute_backend_service not creating regional backend services, despite providing a region, a rn instance group in the same region, load_balancing_scheme INTERNAL and not using any of the variables for global services.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

gcp_compute_backend_service

ANSIBLE VERSION
ansible 2.7.5
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/kloeffler/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/kloeffler/.local/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516]
CONFIGURATION
empty
OS / ENVIRONMENT

Debian stretch against running google cloud api

STEPS TO REPRODUCE

vars/main.yml

ig_test:
  - name: "sql-lb"
    type: sql
  - name: "gfs-lb"
    type: gfs

tasks/main.yml

- name: gather facts of the network test
  gcp_compute_network:
    name: test
    project: test-project
    auth_kind: serviceaccount
    service_account_file: "{{ credentials_file }}"
    state: present
  register: network 

- name: gather facts about subnetwork of test-europe-west3
  gcp_compute_subnetwork:
    name: test-sub-europe-west3
    region: europe-west3
    network: "{{ network }}"
    ip_cidr_range: 10.157.73.0/24"
    project: test-project
    auth_kind: serviceaccount
    service_account_file: "{{ credentials_file }}"
  register: subnetwork

- name: create a instance group
  gcp_compute_instance_group:
      name: "{{item.name}}"
      zone: europe-west3-a
      region: europe-west3
      network: "{{ network }}"
      subnetwork: "{{ subnetwork }}"
      project: test-project
      auth_kind: serviceaccount
      service_account_file: "{{ credentials_file }}"
      state: present
  loop: "{{ ig_test | list }}"
  register: igs_static

- name: create a backend service
  gcp_compute_backend_service:
    name: "test-{{load_balancer.type}}-europe-west3"
    load_balancing_scheme: INTERNAL
    protocol: TCP 
    region: europe-west3
    backends:
    - group: "{{ item }}"
    health_checks:
    - "https://mylink//healthChecks/check-http-port-8000"
    project: test-project
    auth_kind: serviceaccount
    service_account_file: "{{ credentials_file }}"
    state: present
  when: item._ansible_item_label.name == "test-sql-static"
  with_items: "{{ igs_static.results }}"


EXPECTED RESULTS

I expect this to create a regional backend service.
Creation fails: "msg": "GCP returned error: {u'error': {u'code': 400, u'message': u"Invalid value for field 'resource.loadBalancingScheme': 'INTERNAL'. Load balancing scheme must be external for a global backend service.", u'errors': [{u'domain': u'global', u'message': u"Invalid value for field 'resource.loadBalancingScheme': 'INTERNAL'. Load balancing scheme must be external for a global backend service.", u'reason': u'invalid'}]}}"

ACTUAL RESULTS
The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_gcp_compute_backend_service_payload_Kwcgbe/ansible_gcp_compute_backend_service_payload.zip/ansible/module_utils/gcp_utils.py", line 187, in raise_for_status
    response.raise_for_status()
  File "/home/kloeffler/.local/lib/python2.7/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)

failed: [localhost] (item={'_ansible_parsed': True, u'description': u'', '_ansible_no_log': False, '_ansible_item_result': True, u'fingerprint': u'42WmSpB8rSM=', u'creationTimestamp': u'2018-12-20T01:59:22.668-08:00', u'id': u'8292172775078418709', u'network': u'https://www.googleapis.com/compute/v1/projects/test-project/global/networks/test', u'name': u'test-sql-static', u'kind': u'compute#instanceGroup', '_ansible_item_label': {u'sm_zones': u'single', u'ig_region': u'europe-west3', u'subnetwork': u'test-europe-west3', u'zone': u'europe-west3-a', u'name': u'test-sql-static'}, u'zone': u'https://www.googleapis.com/compute/v1/projects/test-project/zones/europe-west3-a', 'failed': False, u'changed': False, 'item': {u'sm_zones': u'single', u'ig_region': u'europe-west3', u'subnetwork': u'test-europe-west3', u'zone': u'europe-west3-a', u'name': u'test-sql-static'}, u'selfLink': u'https://www.googleapis.com/compute/v1/projects/test-project/zones/europe-west3-a/instanceGroups/test-sql-static', u'invocation': {u'module_args': {u'scopes': [u'https://www.googleapis.com/auth/compute'], u'network': {u'kind': u'compute#network', u'name': u'test', u'subnetworks': [u'https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west3/subnetworks/test-sub-europe-west3', u'https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west1/subnetworks/test-sub-europe-west1', u'https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west2/subnetworks/test-sub-europe-west2'], u'changed': False, u'routingConfig': {u'routingMode': u'REGIONAL'}, u'failed': False, u'id': u'6641937934980594340', u'creationTimestamp': u'2018-12-17T12:17:15.288-08:00', u'autoCreateSubnetworks': False, u'selfLink': u'https://www.googleapis.com/compute/v1/projects/test-project/global/networks/test', u'peerings': [{u'state': u'ACTIVE', u'stateDetails': u'[2018-12-18T05:16:21.103-08:00]: Connected.', u'autoCreateRoutes': True, u'network': u'https://www.googleapis.com/compute/v1/projects/test-project/global/networks/infra', u'name': u'test2infra'}]}, u'zone': u'europe-west3-a', u'service_account_email': None, u'region': u'europe-west3', u'description': None, u'project': u'test-project', u'named_ports': None, u'state': u'present', u'auth_kind': u'serviceaccount', u'service_account_file': u'/home/kloeffler/.TEST-shop-ce88ccc270d0.json', u'subnetwork': {u'kind': u'compute#subnetwork', u'name': u'test-sub-europe-west3', u'creationTimestamp': u'2018-12-17T12:18:50.833-08:00', u'region': u'https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west3', u'changed': False, u'failed': False, u'fingerprint': u'VcMCw6Ld98U=', u'privateIpGoogleAccess': True, u'ipCidrRange': u'10.157.73.0/24', u'gatewayAddress': u'10.157.73.1', u'id': u'3279489050615331397', u'selfLink': u'https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west3/subnetworks/test-sub-europe-west3', u'network': u'https://www.googleapis.com/compute/v1/projects/test-project/global/networks/test'}, u'name': u'test-sql-static'}}, u'subnetwork': u'https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west3/subnetworks/test-sub-europe-west3', u'size': 0, '_ansible_ignore_errors': None}) => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "affinity_cookie_ttl_sec": null, 
            "auth_kind": "serviceaccount", 
            "backends": [
                {
                    "balancing_mode": null, 
                    "capacity_scaler": null, 
                    "description": null, 
                    "group": {
                        "_ansible_ignore_errors": null, 
                        "_ansible_item_label": {
                            "ig_region": "europe-west3", 
                            "name": "test-sql-static", 
                            "sm_zones": "single", 
                            "subnetwork": "test-europe-west3", 
                            "zone": "europe-west3-a"
                        }, 
                        "_ansible_item_result": true, 
                        "_ansible_no_log": false, 
                        "_ansible_parsed": true, 
                        "changed": false, 
                        "creationTimestamp": "2018-12-20T01:59:22.668-08:00", 
                        "description": "", 
                        "failed": false, 
                        "fingerprint": "42WmSpB8rSM=", 
                        "id": "8292172775078418709", 
                        "invocation": {
                            "module_args": {
                                "auth_kind": "serviceaccount", 
                                "description": null, 
                                "name": "test-sql-static", 
                                "named_ports": null, 
                                "network": {
                                    "autoCreateSubnetworks": false, 
                                    "changed": false, 
                                    "creationTimestamp": "2018-12-17T12:17:15.288-08:00", 
                                    "failed": false, 
                                    "id": "6641937934980594340", 
                                    "kind": "compute#network", 
                                    "name": "test", 
                                    "peerings": [
                                        {
                                            "autoCreateRoutes": true, 
                                            "name": "test2infra", 
                                            "network": "https://www.googleapis.com/compute/v1/projects/test-project/global/networks/infra", 
                                            "state": "ACTIVE", 
                                            "stateDetails": "[2018-12-18T05:16:21.103-08:00]: Connected."
                                        }
                                    ], 
                                    "routingConfig": {
                                        "routingMode": "REGIONAL"
                                    }, 
                                    "selfLink": "https://www.googleapis.com/compute/v1/projects/test-project/global/networks/test", 
                                    "subnetworks": [
                                        "https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west3/subnetworks/test-sub-europe-west3", 
                                        "https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west1/subnetworks/test-sub-europe-west1", 
                                        "https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west2/subnetworks/test-sub-europe-west2"
                                    ]
                                }, 
                                "project": "test-project", 
                                "region": "europe-west3", 
                                "scopes": [
                                    "https://www.googleapis.com/auth/compute"
                                ], 
                                "service_account_email": null, 
                                "service_account_file": "/home/kloeffler/.TEST-shop-ce88ccc270d0.json", 
                                "state": "present", 
                                "subnetwork": {
                                    "changed": false, 
                                    "creationTimestamp": "2018-12-17T12:18:50.833-08:00", 
                                    "failed": false, 
                                    "fingerprint": "VcMCw6Ld98U=", 
                                    "gatewayAddress": "10.157.73.1", 
                                    "id": "3279489050615331397", 
                                    "ipCidrRange": "10.157.73.0/24", 
                                    "kind": "compute#subnetwork", 
                                    "name": "test-sub-europe-west3", 
                                    "network": "https://www.googleapis.com/compute/v1/projects/test-project/global/networks/test", 
                                    "privateIpGoogleAccess": true, 
                                    "region": "https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west3", 
                                    "selfLink": "https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west3/subnetworks/test-sub-europe-west3"
                                }, 
                                "zone": "europe-west3-a"
                            }
                        }, 
                        "item": {
                            "ig_region": "europe-west3", 
                            "name": "test-sql-static", 
                            "sm_zones": "single", 
                            "subnetwork": "test-europe-west3", 
                            "zone": "europe-west3-a"
                        }, 
                        "kind": "compute#instanceGroup", 
                        "name": "test-sql-static", 
                        "network": "https://www.googleapis.com/compute/v1/projects/test-project/global/networks/test", 
                        "selfLink": "https://www.googleapis.com/compute/v1/projects/test-project/zones/europe-west3-a/instanceGroups/test-sql-static", 
                        "size": 0, 
                        "subnetwork": "https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west3/subnetworks/test-sub-europe-west3", 
                        "zone": "https://www.googleapis.com/compute/v1/projects/test-project/zones/europe-west3-a"
                    }, 
                    "max_connections": null, 
                    "max_connections_per_instance": null, 
                    "max_rate": null, 
                    "max_rate_per_instance": null, 
                    "max_utilization": null
                }
            ], 
            "cdn_policy": null, 
            "connection_draining": null, 
            "description": null, 
            "enable_cdn": null, 
            "health_checks": [
                "https://www.googleapis.com/compute/v1/projects/test-project/global/healthChecks/check-http-port-8000"
            ], 
            "iap": null, 
            "load_balancing_scheme": "INTERNAL", 
            "name": "test-sql-europe-west3", 
            "port_name": null, 
            "project": "test-project", 
            "protocol": "TCP", 
            "region": "europe-west3", 
            "scopes": [
                "https://www.googleapis.com/auth/compute"
            ], 
            "service_account_email": null, 
            "service_account_file": "/home/kloeffler/infra_setup/test-project-4aee638882f7.json", 
            "session_affinity": null, 
            "state": "present", 
            "timeout_sec": null
        }
    }, 
    "item": {
        "changed": false, 
        "creationTimestamp": "2018-12-20T01:59:22.668-08:00", 
        "description": "", 
        "failed": false, 
        "fingerprint": "42WmSpB8rSM=", 
        "id": "8292172775078418709", 
        "invocation": {
            "module_args": {
                "auth_kind": "serviceaccount", 
                "description": null, 
                "name": "test-sql-static", 
                "named_ports": null, 
                "network": {
                    "autoCreateSubnetworks": false, 
                    "changed": false, 
                    "creationTimestamp": "2018-12-17T12:17:15.288-08:00", 
                    "failed": false, 
                    "id": "6641937934980594340", 
                    "kind": "compute#network", 
                    "name": "test", 
                    "peerings": [
                        {
                            "autoCreateRoutes": true, 
                            "name": "test2infra", 
                            "network": "https://www.googleapis.com/compute/v1/projects/test-project/global/networks/infra", 
                            "state": "ACTIVE", 
                            "stateDetails": "[2018-12-18T05:16:21.103-08:00]: Connected."
                        }
                    ], 
                    "routingConfig": {
                        "routingMode": "REGIONAL"
                    }, 
                    "selfLink": "https://www.googleapis.com/compute/v1/projects/test-project/global/networks/test", 
                    "subnetworks": [
                        "https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west3/subnetworks/test-sub-europe-west3", 
                        "https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west1/subnetworks/test-sub-europe-west1", 
                        "https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west2/subnetworks/test-sub-europe-west2"
                    ]
                }, 
                "project": "test-project", 
                "region": "europe-west3", 
                "scopes": [
                    "https://www.googleapis.com/auth/compute"
                ], 
                "service_account_email": null, 
                "service_account_file": "/home/kloeffler/.TEST-shop-ce88ccc270d0.json", 
                "state": "present", 
                "subnetwork": {
                    "changed": false, 
                    "creationTimestamp": "2018-12-17T12:18:50.833-08:00", 
                    "failed": false, 
                    "fingerprint": "VcMCw6Ld98U=", 
                    "gatewayAddress": "10.157.73.1", 
                    "id": "3279489050615331397", 
                    "ipCidrRange": "10.157.73.0/24", 
                    "kind": "compute#subnetwork", 
                    "name": "test-sub-europe-west3", 
                    "network": "https://www.googleapis.com/compute/v1/projects/test-project/global/networks/test", 
                    "privateIpGoogleAccess": true, 
                    "region": "https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west3", 
                    "selfLink": "https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west3/subnetworks/test-sub-europe-west3"
                }, 
                "zone": "europe-west3-a"
            }
        }, 
        "item": {
            "ig_region": "europe-west3", 
            "name": "test-sql-static", 
            "sm_zones": "single", 
            "subnetwork": "test-europe-west3", 
            "zone": "europe-west3-a"
        }, 
        "kind": "compute#instanceGroup", 
        "name": "test-sql-static", 
        "network": "https://www.googleapis.com/compute/v1/projects/test-project/global/networks/test", 
        "selfLink": "https://www.googleapis.com/compute/v1/projects/test-project/zones/europe-west3-a/instanceGroups/test-sql-static", 
        "size": 0, 
        "subnetwork": "https://www.googleapis.com/compute/v1/projects/test-project/regions/europe-west3/subnetworks/test-sub-europe-west3", 
        "zone": "https://www.googleapis.com/compute/v1/projects/test-project/zones/europe-west3-a"
    }, 
    "msg": "GCP returned error: {u'error': {u'code': 400, u'message': u\"Invalid value for field 'resource.loadBalancingScheme': 'INTERNAL'. Load balancing scheme must be external for a global backend service.\", u'errors': [{u'domain': u'global', u'message': u\"Invalid value for field 'resource.loadBalancingScheme': 'INTERNAL'. Load balancing scheme must be external for a global backend service.\", u'reason': u'invalid'}]}}"
}


@ansibot
Copy link
Contributor

ansibot commented Feb 15, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Feb 15, 2019

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. cloud gce module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. labels Feb 15, 2019
@avandych
Copy link

Any news or workarounds for this one? Have the same problem

@GLaN1K
Copy link

GLaN1K commented Dec 10, 2019

Same.

@akesterton
Copy link

This has also been reported as an issue in Ansible 2.8

@ansibot ansibot added collection Related to Ansible Collections work collection:google.cloud needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md labels Apr 29, 2020
@ansibot
Copy link
Contributor

ansibot commented Aug 16, 2020

Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.

For further information, please see:
https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md

@ansibot ansibot closed this as completed Aug 16, 2020
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Aug 17, 2020
@ansible ansible locked and limited conversation to collaborators Sep 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bot_closed bug This issue/PR relates to a bug. cloud collection:google.cloud collection Related to Ansible Collections work gce module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.
Projects
None yet
Development

No branches or pull requests

6 participants