FAQ | This is a LIVE service | Changelog

Skip to content

Fix multiple longstanding issues

Ryan Kowalewski requested to merge multiple-issues into master

I have reviewed a few of the longstanding issues for this module and have put together this MR to try and move some of them forward.

Issue #7 (closed)

This is a problem in particular when the sql_instance_connection_name variable references a value which is only known after apply. This is always the case when we deploy our boilerplate workspaces for the first time and requires targeted apply steps to work around.

My resolution to this is to simply create a new boolean variable named grant_sql_client_role_to_webapp_sa and use this instead of the sql_instance_connection_name variable to determine whether to grant the SQL role. This will require a change to the boilerplate to add the new variable to the webapp module call and set it to true as the default is false.

Issue #35 (closed)

dashboard.tf uses the deprecated hashicorp/template provider. I have simply refactored to use the built-in templatefile function instead.

Issue #37 (closed)

This issue is because in Terraform 1.0 provider aliases are now to be specified in the terraform.required_provider[name].configuration_aliases list. In the comments of the issue there is a mention that by moving to the new syntax the aliased stackdriver provider becomes required when calling the module, even if you're not deploying the resources which use the provider (i.e. with monitoring disabled). However, I believe that this is just something we will have to accept as it is more important to move away from using the deprecated syntax. Also, there is a simple workaround of just assigning the default google provider to the stackdriver alias in the module call as follows.

module "webapp" {
  source = "git::https://gitlab.developers.cam.ac.uk/uis/devops/infra/terraform/gcp-cloud-run-app.git?ref=5.0.0"
  
  # ...

  providers = {
    google.stackdriver = google
  }
}

Issue #38 (closed)

A map cannot have a key which depends on a resource which is unknown. To resolve this issue I've refactored the map to always have known key names.

NOTE

https://gitlab.developers.cam.ac.uk/uis/devops/gcp-deploy-boilerplate/-/merge_requests/29 will be required once this MR is merged and a new 6.0.0 tag created.

Closes #7 (closed), #35 (closed), #37 (closed), & #38 (closed)

Edited by Ryan Kowalewski

Merge request reports

Loading