-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c699d34
commit 46e18c3
Showing
22 changed files
with
1,319 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
resource "helm_release" "this" { | ||
name = var.release_name | ||
namespace = var.chart.namespace | ||
repository = var.chart.repository | ||
version = var.chart.version | ||
chart = var.chart.name | ||
values = concat([file(var.chart.init_values)], var.chart.values) | ||
|
||
wait = true | ||
wait_for_jobs = true | ||
|
||
cleanup_on_fail = false | ||
atomic = false | ||
verify = false | ||
|
||
dynamic "set" { | ||
for_each = var.chart.set | ||
content { | ||
name = set.key | ||
value = set.value | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
terraform { | ||
required_providers { | ||
helm = { | ||
source = "hashicorp/helm" | ||
version = "2.15.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
variable "chart" { | ||
type = object({ | ||
name = string | ||
version = string | ||
namespace = string | ||
repository = string | ||
values = list(string) | ||
init_values = string | ||
set = map(string) | ||
}) | ||
default = { | ||
name = "cosmo" | ||
version = "0.11.1" | ||
namespace = "cosmo" | ||
repository = "oci://ghcr.io/wundergraph/cosmo/helm-charts" | ||
values = ["ingress"] | ||
init_values = "" | ||
set = {} | ||
} | ||
} | ||
|
||
variable "release_name" { | ||
type = string | ||
default = "cosmo" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
data "helm_template" "this" { | ||
name = var.chart.name | ||
namespace = var.chart.namespace | ||
repository = var.chart.repository | ||
chart = var.chart.name | ||
version = var.chart.version | ||
values = concat([file(var.chart.init_values)], var.chart.values) | ||
|
||
dynamic "set" { | ||
for_each = var.chart.set | ||
content { | ||
name = set.key | ||
value = set.value | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
output "manifests" { | ||
value = data.helm_template.this.manifests | ||
} | ||
|
||
output "manifest" { | ||
value = data.helm_template.this.manifest | ||
} | ||
|
||
output "notes" { | ||
value = data.helm_template.this.notes | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
terraform { | ||
required_providers { | ||
carvel = { | ||
source = "carvel-dev/carvel" | ||
version = "0.11.2" | ||
} | ||
helm = { | ||
source = "hashicorp/helm" | ||
version = "2.15.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
variable "chart" { | ||
type = object({ | ||
name = string | ||
version = string | ||
namespace = string | ||
repository = string | ||
values = list(string) | ||
init_values = string | ||
set = map(string) | ||
}) | ||
default = { | ||
name = "cosmo" | ||
version = "0.11.1" | ||
namespace = "cosmo" | ||
repository = "oci://ghcr.io/wundergraph/cosmo/helm-charts" | ||
values = [] | ||
init_values = "" | ||
set = {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
resource "local_file" "deployment" { | ||
for_each = var.write_deployment_yaml ? { | ||
"deployment" = module.cosmo_charts.manifest | ||
} : {} | ||
|
||
content = module.cosmo_charts.manifest | ||
filename = "${path.module}/${var.stage}-deployment.yaml" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
resource "random_string" "module_prefix" { | ||
length = 6 | ||
special = false | ||
} | ||
|
||
locals { | ||
prefix = lower(random_string.module_prefix.result) | ||
} | ||
|
||
module "cosmo_federated_graph" { | ||
source = "../cosmo-federated-graph" | ||
namespace = "${var.stage}-${local.prefix}" | ||
router_token_name = "${var.stage}-${local.prefix}-router-token" | ||
|
||
federated_graph = { | ||
name = "${local.prefix}-federated-graph" | ||
routing_url = "http://localhost:3000" | ||
label_matchers = [ | ||
"team=backend", | ||
] | ||
} | ||
subgraphs = { | ||
"availability" = { | ||
name = "${var.stage}-${local.prefix}-availability" | ||
routing_url = "http://example.com/routing" | ||
schema = <<EOF | ||
extend schema | ||
@link(url: "https://specs.apollo.dev/federation/v2.5", import: ["@authenticated", "@composeDirective", "@external", "@extends", "@inaccessible", "@interfaceObject", "@override", "@provides", "@key", "@requires", "@requiresScopes", "@shareable", "@tag"]) | ||
type Mutation { | ||
updateAvailability(employeeID: Int!, isAvailable: Boolean!): Employee! | ||
} | ||
type Employee @key(fields: "id") { | ||
id: Int! | ||
isAvailable: Boolean! | ||
} | ||
EOF | ||
readme = "Availabilty Subgraph" | ||
labels = { | ||
"team" = "backend" | ||
"stage" = "${var.stage}" | ||
} | ||
} | ||
"products" = { | ||
name = "${var.stage}-${local.prefix}-products" | ||
routing_url = "http://example.com/routing" | ||
schema = <<EOF | ||
extend schema | ||
@link(url: "https://specs.apollo.dev/federation/v2.5", import: ["@authenticated", "@composeDirective", "@external", "@extends", "@inaccessible", "@interfaceObject", "@override", "@provides", "@key", "@requires", "@requiresScopes", "@shareable", "@tag"]) | ||
schema { | ||
query: Queries | ||
mutation: Mutation | ||
} | ||
type Queries { | ||
productTypes: [Products!]! | ||
topSecretFederationFacts: [TopSecretFact!]! @requiresScopes(scopes: [["read:fact"], ["read:all"]]) | ||
factTypes: [TopSecretFactType!] | ||
} | ||
type Mutation { | ||
addFact(fact: TopSecretFactInput!): TopSecretFact! @requiresScopes(scopes: [["write:fact"], ["write:all"]]) | ||
} | ||
input TopSecretFactInput { | ||
title: String! | ||
description: FactContent! | ||
factType: TopSecretFactType! | ||
} | ||
enum TopSecretFactType @authenticated { | ||
DIRECTIVE, | ||
ENTITY, | ||
MISCELLANEOUS, | ||
} | ||
interface TopSecretFact @authenticated { | ||
description: FactContent! | ||
factType: TopSecretFactType | ||
} | ||
scalar FactContent @requiresScopes(scopes: [["read:scalar"], ["read:all"]]) | ||
type DirectiveFact implements TopSecretFact @authenticated { | ||
title: String! | ||
description: FactContent! | ||
factType: TopSecretFactType | ||
} | ||
type EntityFact implements TopSecretFact @requiresScopes(scopes: [["read:entity"]]){ | ||
title: String! | ||
description: FactContent! | ||
factType: TopSecretFactType | ||
} | ||
type MiscellaneousFact implements TopSecretFact { | ||
title: String! | ||
description: FactContent! @requiresScopes(scopes: [["read:miscellaneous"]]) | ||
factType: TopSecretFactType | ||
} | ||
enum ProductName { | ||
CONSULTANCY | ||
COSMO | ||
ENGINE | ||
FINANCE | ||
HUMAN_RESOURCES | ||
MARKETING | ||
SDK | ||
} | ||
type Employee @key(fields: "id") { | ||
id: Int! | ||
products: [ProductName!]! | ||
notes: String @override(from: "employees") | ||
} | ||
union Products = Consultancy | Cosmo | Documentation | ||
type Consultancy @key(fields: "upc") { | ||
upc: ID! | ||
name: ProductName! | ||
} | ||
type Cosmo @key(fields: "upc") { | ||
upc: ID! | ||
name: ProductName! | ||
repositoryURL: String! | ||
} | ||
type Documentation { | ||
url(product: ProductName!): String! | ||
urls(products: [ProductName!]!): [String!]! | ||
} | ||
EOF | ||
readme = "Products Subgraph" | ||
labels = { | ||
"team" = "backend" | ||
"stage" = "${var.stage}" | ||
} | ||
} | ||
} | ||
|
||
depends_on = [ | ||
module.minikube, | ||
module.cosmo_release | ||
] | ||
} | ||
|
Oops, something went wrong.