Skip to content

fix!: Making Cloud Functions ADC Compliant#194

Merged
apeabody merged 3 commits intoGoogleCloudPlatform:mainfrom
anshukaira:adc-compliance
Jan 26, 2026
Merged

fix!: Making Cloud Functions ADC Compliant#194
apeabody merged 3 commits intoGoogleCloudPlatform:mainfrom
anshukaira:adc-compliance

Conversation

@anshukaira
Copy link
Member

@anshukaira anshukaira commented Nov 11, 2025

Making Cloud Functions ADC Compliant

  • Updated Makefile
  • Added metadata.yaml and metadata.display.yaml files
  • Updated python version for fixing build run in tests

@anshukaira anshukaira requested review from a team and prabhu34 as code owners November 11, 2025 13:13
@anshukaira anshukaira force-pushed the adc-compliance branch 6 times, most recently from 7108ad5 to 0467c6e Compare November 11, 2025 15:13
@apeabody
Copy link
Contributor

Thanks! After this PR is merged, you will want to open a PR to add:

      lint_env = {
        ENABLE_BPMETADATA = "1"
      }

at https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit/blob/b0c6241ea40cd940b153aa3c1e64b53711b4fde0/infra/terraform/test-org/org/locals.tf#L667

@anshukaira
Copy link
Member Author

Thanks! After this PR is merged, you will want to open a PR to add:

      lint_env = {
        ENABLE_BPMETADATA = "1"
      }

at https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit/blob/b0c6241ea40cd940b153aa3c1e64b53711b4fde0/infra/terraform/test-org/org/locals.tf#L667

Created a PR
GoogleCloudPlatform/cloud-foundation-toolkit#3266

@anshukaira anshukaira changed the title chore: Making Cloud Functions ADC Compliant fix: Making Cloud Functions ADC Compliant Nov 12, 2025
@anshukaira anshukaira force-pushed the adc-compliance branch 10 times, most recently from 90d39f1 to 90c9629 Compare November 14, 2025 06:19
@prabhu34
Copy link
Collaborator

@apeabody Need your help here. The builds fail with different errors each time w.r.t to the secure functions modules. Are you aware of the modules being used by any teams?

@amandakarina Can you help here as well ?

@apeabody
Copy link
Contributor

@apeabody Need your help here. The builds fail with different errors each time w.r.t to the secure functions modules. Are you aware of the modules being used by any teams?

@amandakarina Can you help here as well ?

Hi @prabhu34 - Unfortunately I'm not familiar, but the current build failed due to:

  • the Compute Engine API not being enabled in time.
  • an project naming conflict.

For the later, assuming it's a random conflict, I recommend adding: random_project_id_length = 4 to the project factory module defintion as it implements a larger collusion domain than the default.

@github-actions
Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@anshukaira anshukaira requested a review from q2w as a code owner January 20, 2026 07:22
@github-actions github-actions bot removed the Stale label Jan 20, 2026
@anshukaira
Copy link
Member Author

Picking up this PR again, trying to resolve the build errors

@anshukaira anshukaira force-pushed the adc-compliance branch 4 times, most recently from 3be28a9 to 09d7fe2 Compare January 21, 2026 12:34
@anshukaira
Copy link
Member Author

@apeabody @prabhu34

I have tried increasing wait time, changing names and still this seem to have failures. Can you help in resolving this?

@apeabody
Copy link
Contributor

apeabody commented Jan 21, 2026

@apeabody @prabhu34

I have tried increasing wait time, changing names and still this seem to have failures. Can you help in resolving this?

Hi @anshukaira You renamed the project to prj-scf-bq-trg, but didn't update the API list name, etc, to match. For example:

  serverless_project_extra_apis = {
    "prj-scf-bq-trigger" = ["compute.googleapis.com", "networksecurity.googleapis.com", "cloudfunctions.googleapis.com", "cloudbuild.googleapis.com", "eventarc.googleapis.com", "eventarcpublishing.googleapis.com"]
  }

@anshukaira
Copy link
Member Author

hi @apeabody
thanks for the pointer, i missed it while trying to change the project name, and it has resolved the issue. can you please review this PR?

@anshukaira anshukaira changed the title fix: Making Cloud Functions ADC Compliant fix!: Making Cloud Functions ADC Compliant Jan 22, 2026
Copy link
Contributor

@apeabody apeabody left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @anshukaira!

module "cloud_functions2" {
source = "GoogleCloudPlatform/cloud-functions/google"
version = "~> 0.6"
source = "../../"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is automatically rewritten during lint/tests, so the standard is to use a version in the committed version for customers.

Suggested change
source = "../../"
source = "GoogleCloudPlatform/cloud-functions/google"
version = "~> 0.7"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future fix: update to use "released" version and depend on module swapper for lint and & tests

module "cloud_functions2" {
source = "GoogleCloudPlatform/cloud-functions/google"
version = "~> 0.6"
source = "../../"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
source = "../../"
source = "GoogleCloudPlatform/cloud-functions/google"
version = "~> 0.7"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update:

Tried doing this in this test PR - https://github.com/GoogleCloudPlatform/terraform-google-cloud-functions/pull/205/checks?check_run_id=61342778210
and i am seeing failures in test as well as lint. scheduled a call on 26/01 to resolve this issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future fix: update to use "released" version and depend on module swapper for lint and & tests

@@ -35,9 +35,9 @@ module "secure_harness" {
version = "~> 0.21.5"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future change: It's bump the version constraint to "~> 0.23"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -36,7 +36,7 @@ module "secure_harness" {
version = "~> 0.21.5"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future change: It's bump the version constraint to "~> 0.23"

@@ -39,8 +39,8 @@ module "secure_harness" {
version = "~> 0.21.5"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future change: It's bump the version constraint to "~> 0.23"

Copy link
Contributor

@apeabody apeabody left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @anshukaira!

Approved with the notes to please follow-up in a future fix PR.

@apeabody apeabody merged commit 564e92e into GoogleCloudPlatform:main Jan 26, 2026
7 checks passed
@anshukaira anshukaira deleted the adc-compliance branch February 3, 2026 05:45
@anshukaira
Copy link
Member Author

Created a followup PR for this -- #212

Comment on lines +17 to +22
locals {
# If var.location is set, use it. Otherwise, use var.function_location.
# This makes the change backward-compatible.
effective_location = coalesce(var.location, var.function_location)
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not backwards compatible because var.location has no default. So if this module 'A' is consumed in another module 'B', this change has broken module 'B' until it is updated.

ref: terraform-google-modules/terraform-example-foundation#1458

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have created a new major version by using ! as this is a breaking change. So, it should not be breaking other modules if they are using the old major version of cloud functions.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krprabhat-eng but the major version was released as a minor version, 0.8.0.

Terraform's ~> 0.6 operator will resolve to 0.8, as in the linked PR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anshukaira can we approve this & create a new major version for our use case.
@kevcube When we are releasing a new major version, can we simply rename function_location to location ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, removing function_location in favor of location in a new major release is fine @krprabhat-eng

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.

5 participants