GoogleCloudPlatform / anthos-samples

Anthos code samples
https://cloud.google.com/anthos/docs
Apache License 2.0
97 stars 124 forks source link

asmcli: [ERROR]: Cluster is registered in the project [my project num], but the required Fleet project is │ [my project id]. #717

Closed linde closed 1 month ago

linde commented 1 month ago

tried a clean checkout of the code and supplied the following terraform.tfvars values

name_prefix = "kind-attached-20240905-05"
gcp_project_id = "[my project id]"
platform_version="1.30.0-gke.1"
kind_node_image= "kindest/node:v1.30.0"

when running terraform apply things went well all the way up to the asmcli part. it failed at this point:

fetching package "/samples" from "https://github.com/GoogleCloudPlatform/anthos-service-mesh-packages" to
│ "samples"
│ asmcli: Verifying cluster registration.
│ asmcli: [ERROR]: Cluster is registered in the project [my project number], but the required Fleet project is
│ [my project id].
│ Please ensure that the cluster is registered to the [my project id] project.

environment is:

Linux [stevenlinde.c.googlers.com](http://stevenlinde.c.googlers.com/) 6.9.10-1rodete5-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.9.10-1rodete5 (2024-09-04) x86_64 GNU/Linux

terraform v1.9.6

verified I don't have asmcli in my path prior to running.

linde commented 1 month ago

some more about tf env

$ terraform init
Initializing the backend...
Initializing modules...
Initializing provider plugins...
- Reusing previous version of hashicorp/local from the dependency lock file
- Reusing previous version of hashicorp/random from the dependency lock file
- Reusing previous version of hashicorp/null from the dependency lock file
- Reusing previous version of hashicorp/external from the dependency lock file
- Reusing previous version of salrashid123/http-full from the dependency lock file
- Reusing previous version of hashicorp/helm from the dependency lock file
- Reusing previous version of tehcyx/kind from the dependency lock file
- Reusing previous version of hashicorp/google from the dependency lock file
- Using previously-installed hashicorp/helm v2.15.0
- Using previously-installed tehcyx/kind v0.6.0
- Using previously-installed hashicorp/google v5.44.1
- Using previously-installed hashicorp/local v2.5.2
- Using previously-installed hashicorp/random v3.6.3
- Using previously-installed hashicorp/null v3.2.3
- Using previously-installed hashicorp/external v2.3.4
- Using previously-installed salrashid123/http-full v1.3.1

Terraform has been successfully initialized!

no TF_ vars in my environment.

apeabody commented 1 month ago

Thanks for the report @linde!

This appears to be specific to the asmcli execution step. Can you re-run after adding the -v flag to this line: https://github.com/GoogleCloudPlatform/anthos-samples/blob/main/anthos-attached-clusters/modules/attached-install-mesh/main.tf#L31? That will provide more verbose logging during the asmcli execution.

apeabody commented 1 month ago

Hi @linde - With the most recent version you can now use the asmcli_verbose = true argument instead of needing to modify the actual Terraform.

linde commented 1 month ago

hmm, the verbose error help me realized I had been configured for autopush in my cloudtop. thanks, will clear this up and re-validate.

linde commented 1 month ago

ok, that was my problem. when I cleared my local cloud config data and logged in again it eventually work. "eventually" because I had to also set asmcli_enable_gcp_apis to be true. Thanks, very helpful verbose CLI logging!