googlemaps / googlemaps/js-route-optimization-app

Create Maps API Key with Terraform

Open
#128 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
139
Forks
53
Avg merge
3d 23h
Merged PRs (30d)
10

Description

API Keys can now be managed with Terraform via API Keys API. This could eliminate the need to manually create an API Key during project setup.

Reference:

- Enable API Keys API (`apikeys.googleapis.com`)
- Define a new `google_apikeys_key` resource
- Restrict the key's `api_targets` to the following:
- Geocoding API
- Maps JavaScript API
- Places API
- Static Maps API
- Do not set any other restrictions
- Store the [`key_string`](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/apikeys_key#key_string) output value in the existing `maps_api_key` secret

After defining an `google_apikeys_key` resource:
- Remove the manual "Create a Google Maps API Key" step in [Project Setup doc](https://github.com/googlemaps-samples/js-route-optimization-app/blob/main/docs/project.md#create-a-google-maps-api-key)
- Remove the [`maps_api_key`](https://github.com/googlemaps-samples/js-route-optimization-app/blob/main/deployment/variables.tf#L59C11-L59C23) input variable from Terraform and [Deployment doc](https://github.com/googlemaps-samples/js-route-optimization-app/blob/main/docs/deployment.md?plain=1#L65)
- Include upgrade note that after deploying this version, users can delete their previous manually-created key

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.