Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Stackdriver integration to use raw credentials #184

Merged
merged 4 commits into from
Dec 21, 2022

Conversation

tbroden84
Copy link
Contributor

@tbroden84 tbroden84 commented Dec 21, 2022

Improve use of credentials for Stackdriver, fetched from Google Service Account key when enable log and metric integrations.

New arguments

  • credentials - (Optional) Google Service Account key credentials
  • private_key_id - (Optional/Computed) Private key identifier from Google Service Account key

Argument updated with Computed

  • project_id
  • client_email
  • private_key

Log & metric:
Use google_service_account_key resource from google provider to populate new argument credentials. That will base64decode the data and map it into json, to further set values for project_id, client_email, private_key, private_key_id.

resource "google_service_account_key" "service_account_key" {
  service_account_id = google_service_account.service_account.name
}

resource "cloudamqp_integration_log" "stackdriver" {
  instance_id = cloudamqp_instance.instance.id
  name = "stackdriver"
  credentials = google_service_account_key.service_account_key.private_key
}

resource "cloudamqp_integration_metric" "stackdriver" {
  instance_id = cloudamqp_instance.instance.id
  name = "stackdriver"
  credentials = google_service_account_key.service_account_key.private_key
}

Make sure to exclude argument tags if not used or set to "" in request body.

Old way to add the private_key is still supported. But clarified in documentation on what decoding is needed.

resource "cloudamqp_integration_log" "stackdriver" {
  ...
  private_key = jsondecode(base64decode(google_service_account_key.service_account_key.private_key)).private_key
}

Metrics:
Make sure to exclude arguments queue_allowlist, vhost_allowlist if not used or set to "" in request body.

@tbroden84 tbroden84 marked this pull request as ready for review December 21, 2022 11:20
@tbroden84 tbroden84 merged commit cef410b into main Dec 21, 2022
@tbroden84 tbroden84 deleted the stackdriver-integration-raw branch December 21, 2022 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant