-
Notifications
You must be signed in to change notification settings - Fork 15
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
Complete instructions to deploy Tessera GCP #86
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
==========================================
- Coverage 35.80% 34.11% -1.69%
==========================================
Files 16 16
Lines 1363 1407 +44
==========================================
- Hits 488 480 -8
- Misses 801 855 +54
+ Partials 74 72 -2 ☔ View full report in Codecov by Sentry. |
deployment/README.md
Outdated
@@ -20,6 +20,18 @@ the project: | |||
gcloud auth application-default login | |||
``` | |||
|
|||
Then, specify your Google Cloud project ID: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This GCP specific stuff should probably go into a README in the live/example-gcp
directory (my fault - I accidentally put the gcloud
line in above)
deployment/README.md
Outdated
@@ -20,6 +20,18 @@ the project: | |||
gcloud auth application-default login | |||
``` | |||
|
|||
Then, specify your Google Cloud project ID: | |||
```bash | |||
export GOOGLE_PROJECT={VALUE} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use this:
export GOOGLE_PROJECT=$(gcloud config get-value project 2> /dev/null)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe that works if you run this command after you've ran gcloud auth
from a VM inside a project, but that might not always be the case. Otherwise, how can gcloud know which project it should select? When you authenticate via a web link, it doesn't give you the option to select the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadness :(
deployment/README.md
Outdated
Eventually, customize the region (defaults to "us-east1"), and bucket name prefix | ||
(defaults to "tessera"): | ||
```bash | ||
export GOOGLE_REGION={VALUE} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels a bit weird to me to have the behaviour of terragrunt be affected by environment vars (I think it's a niggle from "hermetic config as code & checked in" being violated), but:
a) I'm far from a TF/TG expert, and
b) I suppose this is meant to be an easily runnable example and having folks edit config files in a repo is a bit of an anti pattern.
922d679
to
739081d
Compare
|
||
Then, specify your Google Cloud project ID: | ||
```bash | ||
export GOOGLE_PROJECT={VALUE} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the advantage of doing this with environment variables? It moves away from the the deployment files being fully declarative, which means that two people can check out the same repo and then create different deployments because of inconsistencies in the env naming. It's also more work each time you set up a shell to get back to the same state. The obvious workaround is to create a shell script that sets these values, but then you've just put them in a file, which this change moves away from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I just saw Al's comments which only appear at the overview screen and not on the "files changed" view. Looks like these comments are somewhat redundant!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving the conversation here since I looked at this with Al yesterday, and the goal was specifically to get your opinion on it given that you've spent a lot of time looking at Terraform already.
which means that two people can check out the same repo and then create different deployments because of inconsistencies in the env naming.
: I think this is a feature, I have my own dev GCP project and I'd like to deploy tessera there. Alternatively, I might want to play around with a deployment in the trillian-tessera
project with a CT log, without impacting other folks working on the current existing deployment.
The current setup is already affected by environment variables, the deployment files as they are do not work without setting GOOGLE_PROJECT:
╷
│ Error: Failed to retrieve project, pid: , err: project: required field is not set
│
│ with google_spanner_instance.log_spanner,
│ on main.tf line 52, in resource "google_spanner_instance" "log_spanner":
│ 52: resource "google_spanner_instance" "log_spanner" {
This PR doesn't change this behavior, but it's a improvement because now you only have to set your project ID once, and not both in GOOGLE_PROJECT and in terragrunt.hcl. I think it's the smallest change we can make to allow to:
- fix the current deployment setup
- have customizations in a single place
- allow easy customizations for folks no using the default values in this file
I tried two alternatives before sending this PR:
- not using environment variables, in which case
modules/gcs/main.tf
needs to be edited to specify the provider and project (which can be passed from terragrunt.hcl). That would allow to have all the config declarative, but folks would have to make sure not to add this file edits to their commits. Al wasn't supper keen on modifyingmodules/gcs/main.tf
nor on making folks edit a config file for running quick examples. - using non "reserved" environment variable instead of GOOGLE_PROJECT and GOOGLE_REGION. I thought I'd stick to the defaults ones before customizing things.
I think that another alternative is to use terragrunt to generate the provider config, either with or without making use of environment variables.
What do you recommend?
project_id = "trillian-tessera" | ||
location = "us-central1" | ||
base_name = "example-gcp" | ||
project_id = get_env("GOOGLE_PROJECT", "trillian-example") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be trillian-tessera
to match the old version? I think this name is particularly confusing given we have a repo with (almost) this name which is for the old trillian!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duh. Done, thanks.
6003ce4
to
11a3f9c
Compare
11a3f9c
to
57bfc12
Compare
This PR also changes the base name from "example-gcp" to "trillian-tessera" since I think it makes more sense as a default value. I'd rather fix this sooner rather than later, but happy to revert this change if you think it's too disruptive.