I'd like to create Google Cloud API keys using Terraform.
Is this possible?
Google Cloud provider (version >= 4.14.0) for Terraform now supports creating API Keys.
Updating the answer with an example (as suggested by @noamt, thanks).
The key, in this case, restrict the possible APIs that can use to some GMaps ones:
resource "google_apikeys_key" "maps" {
name = "maps-api-key"
display_name = "Nice name displayed in the UI"
restrictions {
# Example of whitelisting Maps Javascript API and Places API only
api_targets {
service = "maps-backend.googleapis.com"
}
api_targets {
service = "places-backend.googleapis.com"
}
}
}