-
Notifications
You must be signed in to change notification settings - Fork 6
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
2033e22
commit efc11a7
Showing
29 changed files
with
543 additions
and
70 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
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,42 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| terraform | >= 1.3.0 | | ||
| humanitec | ~> 1.0 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| humanitec | ~> 1.0 | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [humanitec_resource_definition.main](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| database\_version | The MySQL, PostgreSQL or SQL Server version to use. | `string` | n/a | yes | | ||
| driver\_account | The ID of the Resource Account which should be used. | `string` | n/a | yes | | ||
| prefix | Prefix for all resources | `string` | n/a | yes | | ||
| private\_network | The VPC network from which the Cloud SQL instance is accessible for private IP. | `string` | n/a | yes | | ||
| project | n/a | `string` | n/a | yes | | ||
| region | GCP region | `string` | n/a | yes | | ||
| tier | The machine type to use. | `string` | n/a | yes | | ||
| append\_logs\_to\_error | Append Terraform logs to error messages. | `bool` | `false` | no | | ||
| name | Resource name (can contain placeholders like ${context.app.id}) | `string` | `""` | no | | ||
| resource\_packs\_gcp\_rev | n/a | `string` | `"ref/heads/main"` | no | | ||
| resource\_packs\_gcp\_url | n/a | `string` | `"https://github.com/humanitec-architecture/resource-packs-gcp.git"` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| id | n/a | | ||
<!-- END_TF_DOCS --> |
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,40 @@ | ||
resource "humanitec_resource_definition" "main" { | ||
driver_type = "humanitec/terraform" | ||
id = "${var.prefix}cloudsql-mysql-instance-basic" | ||
name = "${var.prefix}cloudsql-mysql-instance-basic" | ||
type = "mysql-instance" | ||
|
||
driver_account = var.driver_account | ||
driver_inputs = { | ||
values_string = jsonencode({ | ||
source = { | ||
path = "modules/cloudsql-instance/basic" | ||
rev = var.resource_packs_gcp_rev | ||
url = var.resource_packs_gcp_url | ||
} | ||
|
||
append_logs_to_error = var.append_logs_to_error | ||
|
||
credentials_config = { | ||
environment = { | ||
GOOGLE_CREDENTIALS = "*" | ||
} | ||
} | ||
|
||
variables = { | ||
name = var.name | ||
project = var.project | ||
region = var.region | ||
prefix = var.prefix | ||
app_id = "$${context.app.id}" | ||
env_id = "$${context.env.id}" | ||
res_id = "$${context.res.id}" | ||
|
||
database_version = var.database_version | ||
tier = var.tier | ||
private_network = var.private_network | ||
port = 3306 | ||
} | ||
}) | ||
} | ||
} |
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,3 @@ | ||
output "id" { | ||
value = humanitec_resource_definition.main.id | ||
} |
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,10 @@ | ||
terraform { | ||
required_providers { | ||
humanitec = { | ||
source = "humanitec/humanitec" | ||
version = "~> 1.0" | ||
} | ||
} | ||
|
||
required_version = ">= 1.3.0" | ||
} |
29 changes: 29 additions & 0 deletions
29
humanitec-resource-defs/mysql-instance/basic/terraform.tfvars.example
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,29 @@ | ||
|
||
# Append Terraform logs to error messages. | ||
append_logs_to_error = false | ||
|
||
# The MySQL, PostgreSQL or SQL Server version to use. | ||
database_version = "" | ||
|
||
# The ID of the Resource Account which should be used. | ||
driver_account = "" | ||
|
||
# Resource name (can contain placeholders like ${context.app.id}) | ||
name = "" | ||
|
||
# Prefix for all resources | ||
prefix = "" | ||
|
||
# The VPC network from which the Cloud SQL instance is accessible for private IP. | ||
private_network = "" | ||
|
||
project = "" | ||
|
||
# GCP region | ||
region = "" | ||
|
||
resource_packs_gcp_rev = "ref/heads/main" | ||
resource_packs_gcp_url = "https://github.com/humanitec-architecture/resource-packs-gcp.git" | ||
|
||
# The machine type to use. | ||
tier = "" |
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,55 @@ | ||
variable "prefix" { | ||
description = "Prefix for all resources" | ||
type = string | ||
} | ||
|
||
variable "resource_packs_gcp_rev" { | ||
type = string | ||
default = "ref/heads/main" | ||
} | ||
|
||
variable "resource_packs_gcp_url" { | ||
type = string | ||
default = "https://github.com/humanitec-architecture/resource-packs-gcp.git" | ||
} | ||
|
||
variable "append_logs_to_error" { | ||
description = "Append Terraform logs to error messages." | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "driver_account" { | ||
description = "The ID of the Resource Account which should be used." | ||
type = string | ||
} | ||
|
||
variable "project" { | ||
type = string | ||
} | ||
|
||
variable "region" { | ||
description = "GCP region" | ||
type = string | ||
} | ||
|
||
variable "name" { | ||
type = string | ||
description = "Resource name (can contain placeholders like $${context.app.id})" | ||
default = "" | ||
} | ||
|
||
variable "database_version" { | ||
type = string | ||
description = "The MySQL, PostgreSQL or SQL Server version to use." | ||
} | ||
|
||
variable "tier" { | ||
type = string | ||
description = "The machine type to use." | ||
} | ||
|
||
variable "private_network" { | ||
type = string | ||
description = "The VPC network from which the Cloud SQL instance is accessible for private IP." | ||
} |
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
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
Oops, something went wrong.