Created
January 12, 2024 21:54
-
-
Save edceja/6ad059a137f4b716d68121a332fc8550 to your computer and use it in GitHub Desktop.
deploying my API Gateway using Terraform
This file contains 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
#-------------------- | |
# 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