简体   繁体   中英

How to deploy the Google Cloud Function via Terraform without using a bucket?

I have a java application to be deployed as a Cloud Function. The application is packaged into a jar file. The deployment needs to be done via Terraform.

According to the documentation , the function can be deployed directly from the jar file using the --source parameter:

gcloud functions deploy jar-example \
    --entry-point=Example \
    --runtime=java11 \
    --trigger-http \
    --source=target/deployment

However, the Terraform cloudfunctions_function doesn't seem to support it and requires a bucket to copy the jar there.

Is it possible to deploy Cloud Function via Terraform without the bucket?

I think it is possible to deploy without a bucket, but the source code is to be located in a Cloud Repository: Terraform - source repository block Personally I think that the main reason for that - a necessity to keep the source code (of the deployed function) inside the cloud (to handle exceptions, errors, debugging, etc.). Thus - either a bucket or a git repository.

Are you sure you don't want to use some bucket? It may be a very clean and an efficient way. You might not need a bucket in the same project where you deploy the function to (if that is important for you). An example was described here some time ago: How can I deploy Google Cloud Functions in CI/CD without re-deploying unchanged Cloud Functions In addition, I think there were some recent Medium articles about such deployment as well (for similar examples)...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM