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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

google_cloudfunctions_function terraform changes in every plan #18017

Open
Shantanu-11 opened this issue May 3, 2024 · 7 comments
Open

google_cloudfunctions_function terraform changes in every plan #18017

Shantanu-11 opened this issue May 3, 2024 · 7 comments

Comments

@Shantanu-11
Copy link

Shantanu-11 commented May 3, 2024

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

Terraform v1.2.7
on

  • provider registry.terraform.io/hashicorp/google v4.34.0
  • provider registry.terraform.io/hashicorp/google-beta v4.34.0

Affected Resource(s)

google_cloudfunctions_function

Terraform Configuration

resource "google_cloudfunctions_function" "function_event" {
  name        = var.function_name
  description = var.function_description
  project     = var.project

  entry_point = var.entry_point

  runtime             = var.runtime
  region              = var.region
  available_memory_mb = var.available_memory_mb
  timeout             = var.timeout
  max_instances       = var.max_instances
  ingress_settings    = var.ingress_settings

  environment_variables = var.environment_variables

  build_environment_variables = var.build_environment_variables


  service_account_email = var.service_account_email
  labels                = var.labels

  vpc_connector                 = var.vpc_connector
  vpc_connector_egress_settings = var.vpc_connector_egress_settings

  source_repository {
    url = "https://source.developers.google.com/projects/${var.source_repository_project}/repos/${var.function_name}/moveable-aliases/${local.environments[split("-", var.project)[1]]}/paths/"
  }

  event_trigger {
    event_type = var.trigger_event_type
    resource   = var.trigger_event_resource
    failure_policy {
      retry = var.trigger_event_retry
    }
  }

  lifecycle {
    ignore_changes = [labels["deployment-tool"], source_repository, max_instances, event_trigger["failure_policy"]]
  }
}

Debug Output

No response

Expected Behavior

No changes were detected in the terraform plan as your configuration matches the infrastructure.

Actual Behavior

There are changes detected in source_archive_bucket and source_archive_object and terraform is trying to set them to null. These values were never being set from our configuration.
As for the retry being set to false in the failure_policy block, I have had this as false for a long time and nothing has changed around this

Screenshot from 2024-05-03 16-21-59

Upon applying these changes the apply fails with an error.

image

Steps to reproduce

Create a google_cloud_function without specifying source_archive_bucket OR source_archive_object

  1. The terraform plan generates this plan every time, which fails to apply.

Important Factoids

This has been happening since 1st of May, 2024.

References

No response

b/340347166

@Shantanu-11 Shantanu-11 added the bug label May 3, 2024
@github-actions github-actions bot added forward/review In review; remove label to forward service/cloudfunctions labels May 3, 2024
@alexku7
Copy link

alexku7 commented May 5, 2024

Same issue

@enricojonas
Copy link

Same issue for us,

      ~ event_trigger {
            # (2 unchanged attributes hidden)

          + failure_policy {
              + retry = false
            }
        }

on every apply...

@n-oden
Copy link

n-oden commented May 8, 2024

At the risk of adding a me-too comment: we are also seeing this, but with an interesting wrinkle. We have multiple GCP projects in play here, and the same terraform plan produces the spurious diffs but only in one of the projects.

@fcuenca4
Copy link

fcuenca4 commented May 8, 2024

as a workaround, but not ideal in some cases. You can add a lifecycle policy to prevent these to appear in your plan

lifecycle {
    ignore_changes = [
      source_archive_bucket,
      source_archive_object,
    ]
  }

use it careful as it ignores changes in source and object

@ggtisc ggtisc self-assigned this May 10, 2024
@ggtisc
Copy link
Collaborator

ggtisc commented May 13, 2024

Multiple users are experiencing the same issue, and due to all the permissions and configurations that this ticket involves I'm forwarding it directly

@ggtisc ggtisc removed the forward/review In review; remove label to forward label May 13, 2024
@Shantanu-11
Copy link
Author

@ggtisc Any updates on this?

@dixuswe
Copy link

dixuswe commented May 28, 2024

@ggtisc Any updates on this?

this should have been fixed for a while

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants