Skip to content

Commit

Permalink
Add new project root module for measurement-lab (#69)
Browse files Browse the repository at this point in the history
* Adds google.visualizations provider alias to mlab-oti main.tf

We aren't currently using the visualizations module anywhere in the mlab-oti
configuration. However, TF's documentation makes it sound like you should
always list all configuration aliases in the required_providers section, which
is shared between all projects. If you add the alias to the
configuration_aliases list, but don't declare it in the module, TF will emit an
error.

* Adds new project root module for measurement-lab

As a start, it adds the visualizations module, since the public Grafana
instance will run in that project.

* Adds provider alias defs for platform-cluster and visualizations

versions.tf is shared between all projects, and in that file any
configuration_aliases that are listed, must be defined in the root module, even
if those aliases are not used.
  • Loading branch information
nkinkade committed Mar 5, 2024
1 parent 102f1ae commit 5a82add
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 1 deletion.
22 changes: 22 additions & 0 deletions measurement-lab/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions measurement-lab/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
terraform {
backend "gcs" {
# Terraform does not allow variable interpolation in backend blocks.
bucket = "terraform-support-measurement-lab"
prefix = "state"
}
}

provider "google" {
project = "measurement-lab"
}

provider "google" {
alias = "platform-cluster"
project = "measurement-lab"
region = "us-central1"
zone = "us-central1-a"
}

provider "google" {
alias = "data-pipeline"
project = "measurement-lab"
region = "us-central1"
zone = "us-central1-a"
}

provider "google" {
alias = "visualizations"
project = "measurement-lab"
region = "us-central1"
zone = "us-central1-a"
}
1 change: 1 addition & 0 deletions measurement-lab/versions.tf
7 changes: 7 additions & 0 deletions measurement-lab/visualizations.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module "visualizations" {
source = "../modules/visualizations"

providers = {
google = google.visualizations
}
}
14 changes: 14 additions & 0 deletions mlab-autojoin/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,17 @@ provider "google" {
region = "us-central1"
zone = "us-central1-a"
}

provider "google" {
alias = "platform-cluster"
project = "mlab-autojoin"
region = "us-central1"
zone = "us-central1-a"
}

provider "google" {
alias = "visualizations"
project = "mlab-autojoin"
region = "us-central1"
zone = "us-central1-a"
}
7 changes: 7 additions & 0 deletions mlab-oti/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ provider "google" {
region = "us-central1"
zone = "us-central1-a"
}

provider "google" {
alias = "visualizations"
project = "mlab-oti"
region = "us-central1"
zone = "us-central1-a"
}
3 changes: 2 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ terraform {
version = "5.12.0"
configuration_aliases = [
google.data-pipeline,
google.platform-cluster
google.platform-cluster,
google.visualizations
]
}
}
Expand Down

0 comments on commit 5a82add

Please sign in to comment.