-
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.
Update generated example library content (#119)
Co-authored-by: TobiasBabin <[email protected]>
- Loading branch information
1 parent
cf54551
commit 2b204dd
Showing
6 changed files
with
283 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
resource-definitions/generic-async-driver/inline-terraform/agent-runner.tf
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,17 @@ | ||
resource "humanitec_resource_definition" "agent-runner" { | ||
driver_type = "humanitec/agent" | ||
id = "agent-runner" | ||
name = "agent-runner" | ||
type = "agent" | ||
driver_inputs = { | ||
values_string = jsonencode({ | ||
"id" = "my-agent" | ||
}) | ||
} | ||
} | ||
|
||
resource "humanitec_resource_definition_criteria" "agent-runner_criteria_0" { | ||
resource_definition_id = resource.humanitec_resource_definition.agent-runner.id | ||
env_type = "development" | ||
class = "runner" | ||
} |
46 changes: 46 additions & 0 deletions
46
resource-definitions/generic-async-driver/inline-terraform/k8s-cluster-runner-config.tf
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,46 @@ | ||
resource "humanitec_resource_definition" "qa-testing-ground-generic-async" { | ||
driver_type = "humanitec/echo" | ||
id = "qa-testing-ground-generic-async" | ||
name = "qa-testing-ground-generic-async" | ||
type = "config" | ||
driver_inputs = { | ||
values_string = jsonencode({ | ||
"job" = { | ||
"image" = "ghcr.io/my-registry/generic-async-driver-runner:1.0.1" | ||
"command" = [ | ||
"/opt/container" | ||
] | ||
"shared_directory" = "/home/runneruser/workspace" | ||
"namespace" = "humanitec-runner" | ||
"service_account" = "humanitec-runner-job" | ||
"pod_template" = <<END_OF_TEXT | ||
spec: | ||
imagePullSecrets: | ||
- name: ghcr-private-registry | ||
END_OF_TEXT | ||
} | ||
"cluster" = { | ||
"cluster_type" = "gke" | ||
"account" = "my-org/my-gcp-cloud-account" | ||
"cluster" = { | ||
"loadbalancer" = "10.10.10.10" | ||
"name" = "my-cluster" | ||
"project_id" = "my-project" | ||
"zone" = "europe-west2" | ||
"internal_ip" = true | ||
} | ||
} | ||
}) | ||
secret_refs = jsonencode({ | ||
"agent_url" = { | ||
"value" = "$${resources['agent.default#agent'].outputs.url}" | ||
} | ||
}) | ||
} | ||
} | ||
|
||
resource "humanitec_resource_definition_criteria" "qa-testing-ground-generic-async_criteria_0" { | ||
resource_definition_id = resource.humanitec_resource_definition.qa-testing-ground-generic-async.id | ||
env_type = "development" | ||
class = "runner" | ||
} |
99 changes: 99 additions & 0 deletions
99
resource-definitions/generic-async-driver/inline-terraform/s3.tf
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,99 @@ | ||
resource "humanitec_resource_definition" "aws-s3" { | ||
driver_type = "humanitec/generic-async" | ||
id = "aws-s3" | ||
name = "aws-s3" | ||
type = "s3" | ||
driver_account = "my-aws-cloud-account" | ||
driver_inputs = { | ||
values_string = jsonencode({ | ||
"job" = "$${resources['config.runner'].outputs.job}" | ||
"cluster" = { | ||
"cluster_type" = "$${resources['config.runner'].outputs.cluster.cluster_type}" | ||
"account" = "$${resources['config.runner'].outputs.cluster.account}" | ||
"cluster" = "$${resources['config.runner'].outputs.cluster.cluster}" | ||
} | ||
"credentials_config" = { | ||
"environment" = { | ||
"AWS_ACCESS_KEY_ID" = "AccessKeyId" | ||
"AWS_SECRET_ACCESS_KEY" = "SecretAccessKey" | ||
} | ||
} | ||
"files" = { | ||
"terraform.tfvars.json" = "{\"REGION\": \"eu-west-3\", \"BUCKET\": \"$${context.app.id}-$${context.env.id}\"}\n" | ||
"backend.tf" = <<END_OF_TEXT | ||
terraform { | ||
backend "s3" { | ||
bucket = "my-s3-to-store-tf-state" | ||
key = "$${context.res.guresid}/state/terraform.tfstate" | ||
region = "eu-west-3" | ||
} | ||
} | ||
END_OF_TEXT | ||
"providers.tf" = <<END_OF_TEXT | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5.72.0" | ||
} | ||
} | ||
} | ||
END_OF_TEXT | ||
"vars.tf" = <<END_OF_TEXT | ||
variable "REGION" { | ||
type = string | ||
} | ||
variable "BUCKET" { | ||
type = string | ||
} | ||
END_OF_TEXT | ||
"main.tf" = <<END_OF_TEXT | ||
provider "aws" { | ||
region = var.REGION | ||
default_tags { | ||
tags = { | ||
CreatedBy = "Humanitec" | ||
} | ||
} | ||
} | ||
resource "random_string" "bucket_suffix" { | ||
length = 5 | ||
special = false | ||
upper = false | ||
} | ||
module "aws_s3" { | ||
source = "terraform-aws-modules/s3-bucket/aws" | ||
bucket = format("%s-%s", var.BUCKET, random_string.bucket_suffix.result) | ||
acl = "private" | ||
force_destroy = true | ||
control_object_ownership = true | ||
object_ownership = "BucketOwnerPreferred" | ||
} | ||
output "region" { | ||
value = module.aws_s3.s3_bucket_region | ||
} | ||
output "bucket" { | ||
value = module.aws_s3.s3_bucket_id | ||
} | ||
END_OF_TEXT | ||
} | ||
}) | ||
secret_refs = jsonencode({ | ||
"cluster" = { | ||
"agent_url" = { | ||
"value" = "$${resources['config.runner'].outputs.agent_url}" | ||
} | ||
} | ||
}) | ||
} | ||
} | ||
|
||
resource "humanitec_resource_definition_criteria" "aws-s3_criteria_0" { | ||
resource_definition_id = resource.humanitec_resource_definition.aws-s3.id | ||
env_type = "development" | ||
} |
17 changes: 17 additions & 0 deletions
17
resource-definitions/generic-async-driver/private-git-repo/agent-runner.tf
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,17 @@ | ||
resource "humanitec_resource_definition" "agent-runner" { | ||
driver_type = "humanitec/agent" | ||
id = "agent-runner" | ||
name = "agent-runner" | ||
type = "agent" | ||
driver_inputs = { | ||
values_string = jsonencode({ | ||
"id" = "my-agent" | ||
}) | ||
} | ||
} | ||
|
||
resource "humanitec_resource_definition_criteria" "agent-runner_criteria_0" { | ||
resource_definition_id = resource.humanitec_resource_definition.agent-runner.id | ||
env_type = "development" | ||
class = "runner" | ||
} |
46 changes: 46 additions & 0 deletions
46
resource-definitions/generic-async-driver/private-git-repo/k8s-cluster-runner-config.tf
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,46 @@ | ||
resource "humanitec_resource_definition" "qa-testing-ground-generic-async" { | ||
driver_type = "humanitec/echo" | ||
id = "qa-testing-ground-generic-async" | ||
name = "qa-testing-ground-generic-async" | ||
type = "config" | ||
driver_inputs = { | ||
values_string = jsonencode({ | ||
"job" = { | ||
"image" = "ghcr.io/my-registry/generic-async-driver-runner:1.0.1" | ||
"command" = [ | ||
"/opt/container" | ||
] | ||
"shared_directory" = "/home/runneruser/workspace" | ||
"namespace" = "humanitec-runner" | ||
"service_account" = "humanitec-runner-job" | ||
"pod_template" = <<END_OF_TEXT | ||
spec: | ||
imagePullSecrets: | ||
- name: ghcr-private-registry | ||
END_OF_TEXT | ||
} | ||
"cluster" = { | ||
"cluster_type" = "gke" | ||
"account" = "my-org/my-gcp-cloud-account" | ||
"cluster" = { | ||
"loadbalancer" = "10.10.10.10" | ||
"name" = "my-cluster" | ||
"project_id" = "my-project" | ||
"zone" = "europe-west2" | ||
"internal_ip" = true | ||
} | ||
} | ||
}) | ||
secret_refs = jsonencode({ | ||
"agent_url" = { | ||
"value" = "$${resources['agent.default#agent'].outputs.url}" | ||
} | ||
}) | ||
} | ||
} | ||
|
||
resource "humanitec_resource_definition_criteria" "qa-testing-ground-generic-async_criteria_0" { | ||
resource_definition_id = resource.humanitec_resource_definition.qa-testing-ground-generic-async.id | ||
env_type = "development" | ||
class = "runner" | ||
} |
58 changes: 58 additions & 0 deletions
58
resource-definitions/generic-async-driver/private-git-repo/s3.tf
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,58 @@ | ||
resource "humanitec_resource_definition" "aws-s3" { | ||
driver_type = "humanitec/generic-async" | ||
id = "aws-s3" | ||
name = "aws-s3" | ||
type = "s3" | ||
driver_account = "my-aws-cloud-account" | ||
driver_inputs = { | ||
values_string = jsonencode({ | ||
"job" = "$${resources['config.runner'].outputs.job}" | ||
"cluster" = { | ||
"cluster_type" = "$${resources['config.runner'].outputs.cluster.cluster_type}" | ||
"account" = "$${resources['config.runner'].outputs.cluster.account}" | ||
"cluster" = "$${resources['config.runner'].outputs.cluster.cluster}" | ||
} | ||
"credentials_config" = { | ||
"environment" = { | ||
"AWS_ACCESS_KEY_ID" = "AccessKeyId" | ||
"AWS_SECRET_ACCESS_KEY" = "SecretAccessKey" | ||
} | ||
} | ||
"source" = { | ||
"path" = "path/to/my/iac/scripts" | ||
"ref" = "refs/heads/main" | ||
"url" = "[email protected]:my-org/my-repo.git" | ||
} | ||
"files" = { | ||
"terraform.tfvars.json" = "{\"REGION\": \"eu-west-3\", \"BUCKET\": \"$${context.app.id}-$${context.env.id}\"}\n" | ||
"backend.tf" = <<END_OF_TEXT | ||
terraform { | ||
backend "s3" { | ||
bucket = "my-s3-to-store-tf-state" | ||
key = "$${context.res.guresid}/state/terraform.tfstate" | ||
region = "eu-west-3" | ||
} | ||
} | ||
END_OF_TEXT | ||
} | ||
}) | ||
secret_refs = jsonencode({ | ||
"cluster" = { | ||
"agent_url" = { | ||
"value" = "$${resources['config.runner'].outputs.agent_url}" | ||
} | ||
} | ||
"source" = { | ||
"ssh_key" = { | ||
"store" = "my-secret-store" | ||
"ref" = "my-path-to-git-ssh-key" | ||
} | ||
} | ||
}) | ||
} | ||
} | ||
|
||
resource "humanitec_resource_definition_criteria" "aws-s3_criteria_0" { | ||
resource_definition_id = resource.humanitec_resource_definition.aws-s3.id | ||
env_type = "development" | ||
} |