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

google_cloudfunctions_function - egress settings Enum is invalid #6210

Closed
gal432 opened this issue Apr 26, 2020 · 3 comments
Closed

google_cloudfunctions_function - egress settings Enum is invalid #6210

gal432 opened this issue Apr 26, 2020 · 3 comments
Assignees
Labels
bug forward/review In review; remove label to forward service/cloudfunctions

Comments

@gal432
Copy link

gal432 commented Apr 26, 2020

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 the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

V0.12.18

Affected Resource(s)

  • google_cloudfunctions_function

Terraform Configuration Files

resource "google_cloudfunctions_function" "notification_cloud_function" {
  name = "my-function"
  timeout = 120
  runtime = "python37"
  source_archive_bucket = "bucket-source-code"
  source_archive_object = "my-zip.zip"
  service_account_email = "service account email"

  entry_point = "handle_pubsub_message"
  event_trigger {
    event_type = "google.pubsub.topic.publish"
    resource = "topic-name"
  }

  vpc_connector = vpc-network
  vpc_connector_egress_settings = "ALL_TRAFFIC"
}

Debug Output

Panic Output

Expected Behavior

Cloud function should be created with vpc_connector_egress_settings ALL_TRAFFIC

Actual Behavior

Error 400 from google

Important Factoids

References

When I took a look in the code I see that we used ALL_TRAFFIC in
#5984

but in the docs it should be all
https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--egress-settings

@ghost ghost added bug labels Apr 26, 2020
@venkykuberan venkykuberan self-assigned this Apr 26, 2020
@venkykuberan
Copy link
Contributor

@gal432 I am not sure what value is passed to vpc_connector, make sure its in the format projects/xxx/locations/us-central1/connectors/vpcconn. If you still get the error, please share your debug log. The following config worked fine for me

sample config

resource "google_cloudfunctions_function" "py-function" {
  name                  = "python_function"
  description           = "Pull code from GCS"
  available_memory_mb   = 256
  region                = "us-central1"
  runtime               = "python37"
  trigger_http          = true
  entry_point           = "test_function"
  timeout               = 60
  source_archive_bucket = google_storage_bucket.functions_bucket.name
  source_archive_object = google_storage_bucket_object.functions_code_archive.name
  project               = var.project_id 
 
  vpc_connector                 = google_vpc_access_connector.connector.id
  vpc_connector_egress_settings = "ALL_TRAFFIC"
}

resource "google_vpc_access_connector" "connector" {
  name          = "vpcconn"
  region        = "us-central1"
  ip_cidr_range = "10.8.0.0/28"
  network       = "default"
}

@gal432
Copy link
Author

gal432 commented Apr 28, 2020

OK. the problem was when I set the connector.name instead of connector id. the cloud function did attached to the vpc_connector, but I couldn't use the vpc_connector_egress_settings.

@gal432 gal432 closed this as completed Apr 28, 2020
@ghost ghost removed the waiting-response label Apr 28, 2020
@ghost
Copy link

ghost commented May 28, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators May 28, 2020
@github-actions github-actions bot added service/cloudfunctions forward/review In review; remove label to forward labels Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug forward/review In review; remove label to forward service/cloudfunctions
Projects
None yet
Development

No branches or pull requests

2 participants