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

Add cluster ID to outputs #886

Merged
merged 1 commit into from
May 5, 2021
Merged

Add cluster ID to outputs #886

merged 1 commit into from
May 5, 2021

Conversation

ferrarimarco
Copy link
Contributor

This PR adds the GKE Cluster id as an output. Having the id handy saves users from having to fetch that id with a data source.

Additionally, this is likely a prerequisite for #860

Closes #885

@ferrarimarco
Copy link
Contributor Author

/cc @morgante

@comment-bot-dev
Copy link

Thanks for the PR! 🚀
Unfortunately it looks like some of our CI checks failed. See the Contributing Guide for details.

  • ⚠️check_terraform
    Failed Terraform check. More details below.
Attempting to download /workspace/test/bundle.hcl bundle.
/tmp/bundler /workspace
Fetching Terraform 0.13.6 core package...
Local plugin directory ".plugins" found; scanning for provider binaries.
No ".plugins" directory found, skipping local provider discovery.
Creating terraform_0.13.6-bundle2021050507_linux_amd64.zip ...
All done!
Archive:  terraform_0.13.6-bundle2021050507_linux_amd64.zip
/workspace
Running terraform fmt
Running terraform validate
terraform_validate . 
Success!
The configuration is valid.
terraform_validate ./examples/deploy_service 
Success!
The configuration is valid.
terraform_validate ./examples/disable_client_cert 
Success!
The configuration is valid.
terraform_validate ./examples/node_pool 
Success!
The configuration is valid.
terraform_validate ./examples/node_pool_update_variant 
Success!
The configuration is valid.
terraform_validate ./examples/node_pool_update_variant_beta 
Success!
The configuration is valid.
terraform_validate ./examples/node_pool_update_variant_public_beta 
Success!
The configuration is valid.
terraform_validate ./examples/private_zonal_with_networking 
Warning: 
Interpolation-only expressions are deprecated
 on main.tf line 42, in module "gcp-network":
 42:     
"${var.subnetwork}"
= [
Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.
Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.
Success!
The configuration is valid, but there were some validation warnings as shown above.
terraform_validate ./examples/regional_private_node_pool_oauth_scopes 
Success!
The configuration is valid.
terraform_validate ./examples/safer_cluster 
There are some problems with the configuration, described below.
The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.
Warning: 
Interpolation-only expressions are deprecated
 on network.tf line 37, in module "gcp-network":
 37:     
"${local.subnet_name}"
= [
Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.
Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.
Error: 
Duplicate output definition
 on ../../modules/safer-cluster/outputs.tf line 24:
 24: 
output "name"
{
An output named "name" was already defined at
../../modules/safer-cluster/outputs.tf:19,1-14. Output names must be unique
within a module.
terraform_validate ./examples/safer_cluster_iap_bastion 
There are some problems with the configuration, described below.
The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.
Warning: 
Interpolation-only expressions are deprecated
 on network.tf line 36, in module "vpc":
 36:     
"${var.subnet_name}"
= [
Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.
Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.
Error: 
Duplicate output definition
 on ../../modules/safer-cluster/outputs.tf line 24:
 24: 
output "name"
{
An output named "name" was already defined at
../../modules/safer-cluster/outputs.tf:19,1-14. Output names must be unique
within a module.
terraform_validate ./examples/shared_vpc 
Success!
The configuration is valid.
terraform_validate ./examples/simple_regional 
Success!
The configuration is valid.
terraform_validate ./examples/simple_regional_beta 
Success!
The configuration is valid.
terraform_validate ./examples/simple_regional_private 
Success!
The configuration is valid.
terraform_validate ./examples/simple_regional_private_beta 
Success!
The configuration is valid.
terraform_validate ./examples/simple_regional_with_kubeconfig 
Success!
The configuration is valid.
terraform_validate ./examples/simple_regional_with_networking 
Warning: 
Interpolation-only expressions are deprecated
 on main.tf line 45, in module "gcp-network":
 45:     
"${var.subnetwork}"
= [
Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.
Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.
Success!
The configuration is valid, but there were some validation warnings as shown above.
terraform_validate ./examples/simple_zonal_private 
Success!
The configuration is valid.
terraform_validate ./examples/simple_zonal_with_acm 
Success!
The configuration is valid.
terraform_validate ./examples/simple_zonal_with_asm 
Success!
The configuration is valid.
terraform_validate ./examples/simple_zonal_with_hub 
Success!
The configuration is valid.
terraform_validate ./examples/simple_zonal_with_hub_kubeconfig 
Success!
The configuration is valid.
terraform_validate ./examples/stub_domains 
Success!
The configuration is valid.
terraform_validate ./examples/stub_domains_private 
Success!
The configuration is valid.
terraform_validate ./examples/stub_domains_upstream_nameservers 
Success!
The configuration is valid.
terraform_validate ./examples/upstream_nameservers 
Success!
The configuration is valid.
terraform_validate ./examples/workload_identity 
Success!
The configuration is valid.
terraform_validate ./examples/workload_metadata_config 
Success!
The configuration is valid.
terraform_validate ./modules/acm 
Success!
The configuration is valid.
terraform_validate ./modules/asm 
Success!
The configuration is valid.
terraform_validate ./modules/auth 
Success!
The configuration is valid.
terraform_validate ./modules/beta-private-cluster 
Success!
The configuration is valid.
terraform_validate ./modules/beta-private-cluster-update-variant 
Success!
The configuration is valid.
terraform_validate ./modules/beta-public-cluster 
Success!
The configuration is valid.
terraform_validate ./modules/beta-public-cluster-update-variant 
Success!
The configuration is valid.
terraform_validate ./modules/binary-authorization 
Success!
The configuration is valid.
terraform_validate ./modules/config-sync 
Success!
The configuration is valid.
terraform_validate ./modules/hub 
Success!
The configuration is valid.
terraform_validate ./modules/k8s-operator-crd-support 
Success!
The configuration is valid.
terraform_validate ./modules/private-cluster 
Success!
The configuration is valid.
terraform_validate ./modules/private-cluster-update-variant 
Success!
The configuration is valid.
terraform_validate ./modules/safer-cluster 
There are some problems with the configuration, described below.
The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.
Error: 
Duplicate output definition
 on outputs.tf line 24:
 24: 
output "name"
{
An output named "name" was already defined at outputs.tf:19,1-14. Output names
must be unique within a module.
terraform_validate ./modules/safer-cluster-update-variant 
There are some problems with the configuration, described below.
The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.
Error: 
Duplicate output definition
 on outputs.tf line 24:
 24: 
output "name"
{
An output named "name" was already defined at outputs.tf:19,1-14. Output names
must be unique within a module.
terraform_validate ./modules/services 
Success!
The configuration is valid.
terraform_validate ./modules/workload-identity 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/beta_cluster 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/deploy_service 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/disable_client_cert 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/node_pool 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/node_pool_update_variant 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/private_zonal_with_networking 
Warning: 
Interpolation-only expressions are deprecated
 on ../../../examples/private_zonal_with_networking/main.tf line 42, in module "gcp-network":
 42:     
"${var.subnetwork}"
= [
Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.
Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.
Success!
The configuration is valid, but there were some validation warnings as shown above.
terraform_validate ./test/fixtures/safer_cluster 
There are some problems with the configuration, described below.
The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.
Warning: 
Interpolation-only expressions are deprecated
 on ../../../examples/safer_cluster/network.tf line 37, in module "gcp-network":
 37:     
"${local.subnet_name}"
= [
Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.
Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.
Error: 
Duplicate output definition
 on ../../../modules/safer-cluster/outputs.tf line 24:
 24: 
output "name"
{
An output named "name" was already defined at
../../../modules/safer-cluster/outputs.tf:19,1-14. Output names must be unique
within a module.
terraform_validate ./test/fixtures/safer_cluster_iap_bastion 
There are some problems with the configuration, described below.
The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.
Warning: 
Interpolation-only expressions are deprecated
 on ../../../examples/safer_cluster_iap_bastion/network.tf line 36, in module "vpc":
 36:     
"${var.subnet_name}"
= [
Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.
Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.
Error: 
Duplicate output definition
 on ../../../modules/safer-cluster/outputs.tf line 24:
 24: 
output "name"
{
An output named "name" was already defined at
../../../modules/safer-cluster/outputs.tf:19,1-14. Output names must be unique
within a module.
terraform_validate ./test/fixtures/sandbox_enabled 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/simple_regional 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/simple_regional_private 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/simple_regional_with_kubeconfig 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/simple_regional_with_networking 
Warning: 
Interpolation-only expressions are deprecated
 on ../../../examples/simple_regional_with_networking/main.tf line 45, in module "gcp-network":
 45:     
"${var.subnetwork}"
= [
Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.
Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.
Success!
The configuration is valid, but there were some validation warnings as shown above.
terraform_validate ./test/fixtures/simple_zonal 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/simple_zonal_private 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/simple_zonal_with_asm 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/stub_domains 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/stub_domains_private 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/stub_domains_upstream_nameservers 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/upstream_nameservers 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/workload_identity 
Success!
The configuration is valid.
terraform_validate ./test/fixtures/workload_metadata_config 
Success!
The configuration is valid.
terraform_validate ./test/setup 
Success!
The configuration is valid.

@ferrarimarco
Copy link
Contributor Author

Fixed the duplicate name issue (copy/paste fail :) )

@morgante morgante merged commit fc34eb6 into terraform-google-modules:master May 5, 2021
@ferrarimarco ferrarimarco deleted the cluster-id-output branch May 5, 2021 13:30
CPL-markus pushed a commit to WALTER-GROUP/terraform-google-kubernetes-engine that referenced this pull request Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the cluster ID to the outputs
3 participants