Skip to content

Instantly share code, notes, and snippets.

@edceja
Created January 12, 2024 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edceja/6ad059a137f4b716d68121a332fc8550 to your computer and use it in GitHub Desktop.
Save edceja/6ad059a137f4b716d68121a332fc8550 to your computer and use it in GitHub Desktop.
deploying my API Gateway using Terraform
#--------------------
# API gateway
#--------------------
resource "google_api_gateway_api" "api_gw" {
provider = google-beta
api_id = "my-api"
project = "crcbackend2"
}
resource "google_api_gateway_api_config" "api_cfg" {
provider = google-beta
api = google_api_gateway_api.api_gw.api_id
api_config_id = "my-config"
project = "crcbackend2"
openapi_documents {
document {
path = "my-api.yaml"
contents = filebase64("my-api.yaml")
}
}
lifecycle {
create_before_destroy = true
}
}
resource "google_api_gateway_gateway" "api_gw" {
provider = google-beta
api_config = google_api_gateway_api_config.api_cfg.id
gateway_id = "my-gateway"
project = "crcbackend2"
region = "us-central1"
}
view rawmain.tf hosted with ❤ by GitHub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment