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

An argument named "service_account" is not expected here. #134

Open
ethanbrown3 opened this issue Jun 27, 2024 · 4 comments
Open

An argument named "service_account" is not expected here. #134

ethanbrown3 opened this issue Jun 27, 2024 · 4 comments

Comments

@ethanbrown3
Copy link

ethanbrown3 commented Jun 27, 2024

Since upgrading my module from v0.5.0 to v0.6.0 I'm seeing this error.

│ Error: Unsupported argument
│ 
│   on .terraform/modules/pipeline.stream_producer_function/main.tf line 31, in resource "google_cloudfunctions2_function" "function":
│   31:     service_account       = var.build_service_account
│ 
│ An argument named "service_account" is not expected here.

Here is my template code.

module "stream_producer_function" {
  source = "GoogleCloudPlatform/cloud-functions/google"

  project_id        = var.project_id
  function_name     = "${local.full_app_name}-function"
  function_location = var.region
  runtime           = "python312"
  entrypoint        = "main"
  docker_repository = "projects/${var.project_id}/locations/us-central1/repositories/gcf-artifacts"

  event_trigger = {
    trigger_region        = var.region
    event_type            = "google.cloud.pubsub.topic.v1.messagePublished"
    service_account_email = null
    pubsub_topic          = google_pubsub_topic.producer_trigger_topic.id
    retry_policy          = var.retry_policy
    event_filters         = null
  }

  service_config = var.service_config

  storage_source = {
    bucket = var.bucket_name
    object = google_storage_bucket_object.cf_source_zip_code_object.name
  }

  depends_on = [
    google_storage_bucket_object.cf_source_zip_code_object
  ]

  labels = var.labels
}

d17cfa7#diff-dc46acf24afd63ef8c556b77c126ccc6e578bc87e3aa09a931f33d9bf2532fbbR31

@klapmalt
Copy link

klapmalt commented Jul 4, 2024

Facing the same issue!

module "cf_my-function" {
  source  = "GoogleCloudPlatform/cloud-functions/google"
  version = "~> 0.6.0"

  # Required variables
  function_name     = "my-function"
  project_id        = var.project_id
  function_location = var.region
  runtime           = "python310"
  entrypoint        = "main"

  storage_source = {
    bucket     = var.source_bucket
    object     = google_storage_bucket_object.code_bucket_obj.name
    generation = null
  }

  service_config = {
    service_account_email = module.sa.email
    available_memory      = "8G"
    available_cpu         = "2000m"
  }

  event_trigger = {
    event_type            = "google.cloud.storage.object.v1.finalized"
    service_account_email = module.sa.email
    retry_policy          = "RETRY_POLICY_DO_NOT_RETRY"
    trigger_region        = var.region
    event_filters = [
      {
        attribute       = "bucket"
        attribute_value = var.target_bucket
      }
    ]
  }
}

Works fine with 0.5.0

Copy link

github-actions bot commented Sep 2, 2024

This issue 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

@github-actions github-actions bot added the Stale label Sep 2, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2024
@kormide
Copy link

kormide commented Sep 26, 2024

I am also experiencing this bug. Can the issue be re-opened?

@prabhu34
Copy link
Collaborator

prabhu34 commented Jan 8, 2025

Can you check the configuration arguments? The source blocks should be enclosed within the build_config block which could be the reason.

build_config { . . storage_source = { bucket = var.bucket_name object = google_storage_bucket_object.cf_source_zip_code_object.name } }

@prabhu34 prabhu34 reopened this Jan 8, 2025
@github-actions github-actions bot removed the Stale label Jan 8, 2025
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

No branches or pull requests

4 participants