From 0e63e48a8d0eaa658d654809edbf046e6627947a Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Mon, 9 Nov 2020 17:26:21 +0000 Subject: [PATCH] Add prefix to API Config (#4193) Signed-off-by: Modular Magician --- .changelog/4193.txt | 3 ++ website/docs/r/api_gateway_api.html.markdown | 18 -------- .../r/api_gateway_api_config.html.markdown | 46 ++++--------------- .../docs/r/api_gateway_gateway.html.markdown | 41 ++--------------- 4 files changed, 16 insertions(+), 92 deletions(-) create mode 100644 .changelog/4193.txt diff --git a/.changelog/4193.txt b/.changelog/4193.txt new file mode 100644 index 00000000000..f7c6676a9af --- /dev/null +++ b/.changelog/4193.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +apigateway: added api_config_id_prefix field to `google_api_gateway_api_config` resoure +``` diff --git a/website/docs/r/api_gateway_api.html.markdown b/website/docs/r/api_gateway_api.html.markdown index bc43e74b2f1..677861ae191 100644 --- a/website/docs/r/api_gateway_api.html.markdown +++ b/website/docs/r/api_gateway_api.html.markdown @@ -47,24 +47,6 @@ resource "google_api_gateway_api" "api" { api_id = "api" } ``` - -## Example Usage - Apigateway Api Full - - -```hcl -resource "google_api_gateway_api" "api" { - provider = google-beta - api_id = "api" - display_name = "MM Dev API" - labels = { - environment = "dev" - } -} -``` ## Argument Reference diff --git a/website/docs/r/api_gateway_api_config.html.markdown b/website/docs/r/api_gateway_api_config.html.markdown index 82efa67a95a..14c0c53895f 100644 --- a/website/docs/r/api_gateway_api_config.html.markdown +++ b/website/docs/r/api_gateway_api_config.html.markdown @@ -31,7 +31,7 @@ To get more information about ApiConfig, see: * [API documentation](https://cloud.google.com/api-gateway/docs/reference/rest/v1beta/projects.locations.apis.configs) * How-to Guides - * [Official Documentation](https://cloud.google.com/api-gateway/docs/quickstart) + * [Official Documentation](https://cloud.google.com/api-gateway/docs/creating-api-config)
@@ -50,7 +50,7 @@ resource "google_api_gateway_api" "api_cfg" { resource "google_api_gateway_api_config" "api_cfg" { provider = google-beta api = google_api_gateway_api.api_cfg.api_id - api_config_id = "api-cfg" + api_config_id_prefix = "api-cfg-" openapi_documents { document { @@ -58,36 +58,8 @@ resource "google_api_gateway_api_config" "api_cfg" { contents = filebase64("test-fixtures/apigateway/openapi.yaml") } } -} -``` - -## Example Usage - Apigateway Api Config Full - - -```hcl -resource "google_api_gateway_api" "api_cfg" { - provider = google-beta - api_id = "api-cfg" -} - -resource "google_api_gateway_api_config" "api_cfg" { - provider = google-beta - api = google_api_gateway_api.api_cfg.api_id - api_config_id = "api-cfg" - display_name = "MM Dev API Config" - labels = { - environment = "dev" - } - - openapi_documents { - document { - path = "spec.yaml" - contents = filebase64("test-fixtures/apigateway/openapi.yaml") - } + lifecycle { + create_before_destroy = true } } ``` @@ -106,10 +78,6 @@ The following arguments are supported: (Required) The API to attach the config to. -* `api_config_id` - - (Required) - Identifier to assign to the API Config. Must be unique within scope of the parent resource(api). - The `openapi_documents` block supports: @@ -146,9 +114,15 @@ The `document` block supports: If not specified, backend authentication will be set to use OIDC authentication using the default compute service account Structure is documented below. +* `api_config_id` - + (Optional) + Identifier to assign to the API Config. Must be unique within scope of the parent resource(api). + * `project` - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used. +* `api_config_id_prefix` - (Optional) Creates a unique name beginning with the + specified prefix. If this and api_config_id are unspecified, a random value is chosen for the name. The `gateway_config` block supports: diff --git a/website/docs/r/api_gateway_gateway.html.markdown b/website/docs/r/api_gateway_gateway.html.markdown index a4fad68d2db..7d1b6c10da5 100644 --- a/website/docs/r/api_gateway_gateway.html.markdown +++ b/website/docs/r/api_gateway_gateway.html.markdown @@ -50,7 +50,7 @@ resource "google_api_gateway_api" "api_gw" { resource "google_api_gateway_api_config" "api_gw" { provider = google-beta api = google_api_gateway_api.api_gw.api_id - api_config_id = "api-gw" + api_config_id_prefix = "tf-test-" openapi_documents { document { @@ -58,50 +58,15 @@ resource "google_api_gateway_api_config" "api_gw" { contents = filebase64("test-fixtures/apigateway/openapi.yaml") } } -} - -resource "google_api_gateway_gateway" "api_gw" { - provider = google-beta - api_config = google_api_gateway_api_config.api_gw.id - gateway_id = "api-gw" -} -``` - -## Example Usage - Apigateway Gateway Full - - -```hcl -resource "google_api_gateway_api" "api_gw" { - provider = google-beta - api_id = "api-gw" -} - -resource "google_api_gateway_api_config" "api_gw" { - provider = google-beta - api = google_api_gateway_api.api_gw.api_id - api_config_id = "api-gw" - - openapi_documents { - document { - path = "spec.yaml" - contents = filebase64("test-fixtures/apigateway/openapi.yaml") - } + lifecycle { + create_before_destroy = true } } resource "google_api_gateway_gateway" "api_gw" { provider = google-beta - region = "us-central1" api_config = google_api_gateway_api_config.api_gw.id gateway_id = "api-gw" - display_name = "MM Dev API Gateway" - labels = { - environment = "dev" - } } ```