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 TF input var 'ingress_settings' to allow ingress control for Cloud Functions #83

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/artifactory-to-artifact-registry/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ module "pubsub2inbox" {
available_memory_mb = 2048 # Container contents have to be kept in memory, so the function might need a lot of memory
available_cpu = 2
vpc_connector = var.vpc_config.create_connector ? google_vpc_access_connector.connector[0].id : var.vpc_config.connector
ingress_settings = var.ingress_settings

service_account = "artifactory-to-ar"
pubsub_topic = module.pubsub.id
Expand Down
9 changes: 9 additions & 0 deletions examples/artifactory-to-artifact-registry/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,12 @@ variable "tls_verify" {
default = true
description = "Set false to disable TLS verify of JFrog's cert. This allows JFrog to use a self-signed cert."
}

variable "ingress_settings" {
type = string
# See
# - https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloudfunctions2_function#ingress_settings
# - https://cloud.google.com/functions/docs/networking/network-settings#ingress_settings
description = "VPC Service Controls ingress settings for the Cloud Functions. Default value is ALLOW_ALL. Possible values are: ALLOW_ALL, ALLOW_INTERNAL_ONLY, ALLOW_INTERNAL_AND_GCLB."
default = "ALLOW_ALL"
}
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ resource "google_cloudfunctions2_function" "function" {
available_cpu = var.available_cpu != null ? var.available_cpu : "0.333"
timeout_seconds = var.function_timeout
vpc_connector = var.vpc_connector
ingress_settings = var.ingress_settings
environment_variables = {
CONFIG = google_secret_manager_secret_version.config-secret-version.name
LOG_LEVEL = var.log_level
Expand Down Expand Up @@ -790,6 +791,7 @@ resource "google_cloudfunctions2_function" "json2pubsub-function" {
available_memory = "256M"
timeout_seconds = var.function_timeout
max_instance_request_concurrency = 1
ingress_settings = var.ingress_settings
environment_variables = {
GOOGLE_CLOUD_PROJECT = var.project_id
PUBSUB_TOPIC = basename(var.pubsub_topic)
Expand Down
9 changes: 9 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,12 @@ variable "deploy_json2pubsub" {
grant_sa_user = null
}
}

variable "ingress_settings" {
type = string
# See
# - https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloudfunctions2_function#ingress_settings
# - https://cloud.google.com/functions/docs/networking/network-settings#ingress_settings
description = "VPC Service Controls ingress settings for the Cloud Functions. Default value is ALLOW_ALL. Possible values are: ALLOW_ALL, ALLOW_INTERNAL_ONLY, ALLOW_INTERNAL_AND_GCLB."
default = "ALLOW_ALL"
}