Skip to content

Commit f0ed4c0

Browse files
committed
Add GCS bucket to hold terraform state
1 parent 5e6d24c commit f0ed4c0

File tree

18 files changed

+399
-1
lines changed

18 files changed

+399
-1
lines changed

cmd/clusters-service/app/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ func RunInProcessGateway(ctx context.Context, addr string, setters ...Option) er
438438
// Secure `/v1` and `/gitops/api` API routes
439439
grpcHttpHandler = auth.WithAPIAuth(grpcHttpHandler, srv)
440440
gitopsBrokerHandler = auth.WithAPIAuth(gitopsBrokerHandler, srv)
441-
staticAssets = auth.WithAPIAuth(staticAssets, srv)
441+
staticAssets = auth.WithWebAuth(staticAssets, srv)
442442
}
443443

444444
commonMiddleware := func(mux http.Handler) http.Handler {

terraform/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
### Services
2+
3+
#### Production
4+
- https://gitlab.git.dev.weave.works running on cluster `gitlab-01` on GKE, backed by [repo](https://github.com/wkp-example-org/gitlab-01)
5+
6+
7+
8+
### How to run Terraform locally
9+
10+
1. Authenticate with GCP using `gcloud`.
11+
12+
```sh
13+
gcloud auth application-default login
14+
```
15+
16+
2. Switch to the working directory of your choice and run Terraform.
17+
```sh
18+
cd ./environments/dev
19+
terraform init
20+
terraform plan
21+
```
22+
23+
3. View output variables (optional).
24+
```sh
25+
terraform output
26+
```

terraform/environments/dev/.terraform.lock.hcl

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

terraform/environments/dev/demo-02.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module "demo_02" {
2+
source = "../../modules/gke-cluster"
3+
4+
cluster_name = "demo-02"
5+
region = "europe-north1"
6+
location = "europe-north1-a"
7+
machine_type = "n1-standard-2"
8+
}
9+
10+
output "demo_02_endpoint" {
11+
value = module.demo_02.endpoint
12+
}
13+
14+
output "demo_02_client_certificate" {
15+
value = module.demo_02.client_certificate
16+
sensitive = true
17+
}
18+
19+
output "demo_02_client_key" {
20+
value = module.demo_02.client_key
21+
sensitive = true
22+
}
23+
24+
output "demo_02_cluster_ca_certificate" {
25+
value = module.demo_02.cluster_ca_certificate
26+
sensitive = true
27+
}

terraform/environments/dev/dex-01.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module "dex_01" {
2+
source = "../../modules/gke-cluster"
3+
4+
cluster_name = "dex-01"
5+
region = "europe-north1"
6+
location = "europe-north1-a"
7+
machine_type = "n1-standard-2"
8+
}
9+
10+
output "dex_01_endpoint" {
11+
value = module.dex_01.endpoint
12+
}
13+
14+
output "dex_01_client_certificate" {
15+
value = module.dex_01.client_certificate
16+
sensitive = true
17+
}
18+
19+
output "dex_01_client_key" {
20+
value = module.dex_01.client_key
21+
sensitive = true
22+
}
23+
24+
output "dex_01_cluster_ca_certificate" {
25+
value = module.dex_01.cluster_ca_certificate
26+
sensitive = true
27+
}

terraform/environments/dev/dns.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Zone delegation has been setup manually
2+
# in the Weave Cloud dev account
3+
locals {
4+
zone_id = "Z038735537FBV7QQ5O394"
5+
zone_name ="wge.dev.weave.works"
6+
}
7+
8+
resource "aws_route53_record" "demo_02_ingress" {
9+
zone_id = local.zone_id
10+
name = "demo-02"
11+
type = "A"
12+
ttl = "300"
13+
records = ["35.228.235.99"]
14+
}
15+
16+
resource "aws_route53_record" "dex_01_ingress" {
17+
zone_id = local.zone_id
18+
name = "dex-01"
19+
type = "A"
20+
ttl = "300"
21+
records = ["35.228.83.196"]
22+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
project = "wks-tests"
2+
region = "europe-west1"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
terraform {
2+
backend "gcs" {
3+
bucket = "weave-gitops-enterprise-terraform-state"
4+
prefix = "dev"
5+
}
6+
7+
required_providers {
8+
google = {
9+
source = "hashicorp/google"
10+
version = "~> 4.10.0"
11+
}
12+
aws = {
13+
source = "hashicorp/aws"
14+
version = "~> 4.0.0"
15+
}
16+
}
17+
18+
required_version = ">= 1.1.5"
19+
}
20+
21+
variable "project" {
22+
description = "GCP project id"
23+
}
24+
25+
variable "region" {
26+
description = "GCP project region"
27+
}
28+
29+
provider "google" {
30+
project = var.project
31+
region = var.region
32+
}

terraform/environments/prod/.terraform.lock.hcl

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module "gitlab_01" {
2+
source = "../../modules/gke-cluster"
3+
4+
cluster_name = "gitlab-01"
5+
region = var.region
6+
location = "europe-west1-b"
7+
machine_type = "n2-standard-4"
8+
}
9+
10+
output "gitlab_01_endpoint" {
11+
value = module.gitlab_01.endpoint
12+
}
13+
14+
output "gitlab_01_client_certificate" {
15+
value = module.gitlab_01.client_certificate
16+
sensitive = true
17+
}
18+
19+
output "gitlab_01_client_key" {
20+
value = module.gitlab_01.client_key
21+
sensitive = true
22+
}
23+
24+
output "gitlab_01_cluster_ca_certificate" {
25+
value = module.gitlab_01.cluster_ca_certificate
26+
sensitive = true
27+
}

0 commit comments

Comments
 (0)