GoogleCloudPlatform / k8s-config-connector

GCP Config Connector, a Kubernetes add-on for managing GCP resources
https://cloud.google.com/config-connector/docs/overview
Apache License 2.0
882 stars 215 forks source link

Creation of project with linked billing account fails #180

Closed plejon closed 4 years ago

plejon commented 4 years ago

Describe the bug I am unable to create projects with attached billing account, while using the example below:
https://cloud.google.com/config-connector/docs/reference/resources#sample_yamls_66 The Project is created, but without a linked billing account

Status:
  Conditions:
    Last Transition Time:  2020-05-16T18:39:16Z
    Message:               Update call failed: error applying desired state: Error setting billing account "123QWE-123QWE-123QWE\t" for project "projects/plejon-projid1": googleapi: Error 403: Cloud Billing API has not been used in project 422860842297 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudbilling.googleapis.com/overview?project=422860842297 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry., accessNotConfigured
    Reason:                UpdateFailed
    Status:                False
    Type:                  Ready

ConfigConnector Version 1.19.1

To Reproduce Use example in link above

YAML snippets:

apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1
kind: Project
metadata:
  annotations:
    # Replace "${FOLDER_ID?}" with the numeric ID for your folder
    cnrm.cloud.google.com/folder-id: "123123123123"
    cnrm.cloud.google.com/auto-create-network: "false"
  labels:
    my: "label"
  name: plejon-projid1
spec:
  name: project-id-wdfwfg
  billingAccountRef:
    # Replace "${BILLING_ACCOUNT_ID?}" with the numeric ID for your billing account
    external: "123QWE-123QWE-123QWE"
kibbles-n-bytes commented 4 years ago

Hey @plejon , can you confirm that the Cloud Billing API is enabled for the project number listed in the error message? This is likely the project that the service account for Config Connector lives in. In Google Cloud, if you're making API calls for other projects using a service account, the project the service account lives in will most of the time need that API enabled as well.

plejon commented 4 years ago

Hi @kibbles-n-bytes , thanks for that information. i did not know i had to enable the billing API in the project cc is in. many thanks!