Created
October 18, 2019 17:02
-
-
Save HebertCL/a5756ea86a871fda9ddf548772a0883a to your computer and use it in GitHub Desktop.
This is the configuration I use. You can substitute `var.CONFIG` with your values. I am using git repositories as source for modules. Haven't tested with local modules.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "google_cloudfunctions_function" "gcp_function" { | |
depends_on = [ | |
"null_resource.provision_ready", | |
] | |
name = var.gcp_function_name | |
runtime = var.gcp_function_runtime | |
available_memory_mb = var.gcp_function_available_memory | |
source_archive_bucket = var.gcp_function_archive_bucket | |
source_archive_object = var.gcp_function_archive_object | |
trigger_topic = var.gcp_function_trigger_topic | |
for_each = var.gcp_function_environment_variables | |
environment_variables = { | |
key = each.key | |
value = each.value | |
} | |
} | |
resource "null_resource" "provision_ready" { | |
triggers = { | |
provision_ready = var.provision_ready | |
} | |
} | |
resource "null_resource" "function_complete" { | |
depends_on = [ | |
"null_resource.provision_ready", | |
"google_cloudfunctions_function.gcp_function", | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module "grumman_pubsub" { | |
source = "" | |
provision_ready = var.provision_ready | |
gcp_pubsub_topic_name = var.gcp_pubsub_topic_name | |
} | |
module "grumman_function" { | |
source = "" | |
provision_ready = module.grumman_pubsub.pubsub_complete | |
gcp_function_name = var.gcp_function_name | |
gcp_function_runtime = var.gcp_function_runtime | |
gcp_function_available_memory = var.gcp_function_available_memory | |
gcp_function_archive_bucket = var.gcp_function_archive_bucket | |
gcp_function_archive_object = var.gcp_function_archive_object | |
gcp_function_trigger_topic = module.grumman_pubsub.pubsub_topic | |
gcp_function_environment_variables = var.gcp_function_environment_variables | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "google_pubsub_topic" "gcp_pubsub_topic" { | |
depends_on = [ | |
"null_resource.provision_ready", | |
] | |
name = var.gcp_pubsub_topic_name | |
} | |
resource "null_resource" "provision_ready" { | |
triggers = { | |
provision_ready = var.provision_ready | |
} | |
} | |
resource "null_resource" "pubsub_complete" { | |
depends_on = [ | |
"null_resource.provision_ready", | |
"google_pubsub_topic.gcp_pubsub_topic", | |
] | |
} | |
output "pubsub_topic" { | |
value = google_pubsub_topic.gcp_pubsub_topic.name | |
} | |
output "pubsub_complete" { | |
value = null_resource.pubsub_complete.id | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment