Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add postgres resource #2

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions examples/dns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
| client\_id | The Client ID which should be used. | `string` | n/a | yes |
| client\_secret | The Client Secret which should be used. | `string` | n/a | yes |
| dns\_zone | The id of the hosted zone in which this record set will reside. | `string` | n/a | yes |
| name | Name of the example application. | `string` | n/a | yes |
| resource\_group\_name | The id of the hosted zone in which this record set will reside. | `string` | n/a | yes |
| resource\_group\_name | Specifies the Name of the Resource Group within which this dns will reside. | `string` | n/a | yes |
| subscription\_id | The Subscription ID which should be used. | `string` | n/a | yes |
| tenant\_id | The Tenant ID which should be used. | `string` | n/a | yes |
| name | Name of the example application. | `string` | `"hum-rp-dns-example"` | no |
| prefix | Prefix of the created resources | `string` | `"hum-rp-dns-ex-"` | no |
| resource\_packs\_azure\_rev | Azure Resource Pack git branch. | `string` | `"refs/heads/main"` | no |
| resource\_packs\_azure\_url | Azure Resource Pack git url. | `string` | `"https://github.com/humanitec-architecture/resource-packs-aws.git"` | no |
| resource\_packs\_azure\_url | Azure Resource Pack git url. | `string` | `"https://github.com/humanitec-architecture/resource-packs-azure.git"` | no |
<!-- END_TF_DOCS -->
6 changes: 1 addition & 5 deletions examples/dns/main.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
locals {
res_def_prefix = "${var.name}-"
}

resource "humanitec_application" "example" {
id = var.name
name = var.name
}

module "dns" {
source = "../../humanitec-resource-defs/dns/basic"
prefix = local.res_def_prefix
prefix = var.prefix

resource_packs_azure_url = var.resource_packs_azure_url
resource_packs_azure_rev = var.resource_packs_azure_rev
Expand Down
9 changes: 6 additions & 3 deletions examples/dns/terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ client_secret = ""
dns_zone = ""

# Name of the example application.
name = ""
name = "hum-rp-dns-example"

# The id of the hosted zone in which this record set will reside.
# Prefix of the created resources
prefix = "hum-rp-dns-ex-"

# Specifies the Name of the Resource Group within which this dns will reside.
resource_group_name = ""

# Azure Resource Pack git branch.
resource_packs_azure_rev = "refs/heads/main"

# Azure Resource Pack git url.
resource_packs_azure_url = "https://github.com/humanitec-architecture/resource-packs-aws.git"
resource_packs_azure_url = "https://github.com/humanitec-architecture/resource-packs-azure.git"

# The Subscription ID which should be used.
subscription_id = ""
Expand Down
11 changes: 9 additions & 2 deletions examples/dns/variables.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
variable "prefix" {
description = "Prefix of the created resources"
type = string
default = "hum-rp-dns-ex-"
}

variable "name" {
description = "Name of the example application."
type = string
default = "hum-rp-dns-example"
}

variable "resource_packs_azure_url" {
description = "Azure Resource Pack git url."
type = string
default = "https://github.com/humanitec-architecture/resource-packs-aws.git"
default = "https://github.com/humanitec-architecture/resource-packs-azure.git"
}

variable "resource_packs_azure_rev" {
Expand Down Expand Up @@ -41,6 +48,6 @@ variable "dns_zone" {
}

variable "resource_group_name" {
description = "The id of the hosted zone in which this record set will reside."
description = "Specifies the Name of the Resource Group within which this dns will reside."
type = string
}
46 changes: 46 additions & 0 deletions examples/postgres/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| terraform | >= 1.3.0 |
| humanitec | ~> 0 |

## Providers

| Name | Version |
|------|---------|
| humanitec | ~> 0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| postgres | ../../humanitec-resource-defs/postgres/basic | n/a |

## Resources

| Name | Type |
|------|------|
| [humanitec_application.example](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/application) | resource |
| [humanitec_resource_definition_criteria.postgres](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition_criteria) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| administrator\_login | The Administrator login for the PostgreSQL Server. | `string` | n/a | yes |
| administrator\_login\_password | The Password associated with the administrator\_login for the PostgreSQL Server. | `string` | n/a | yes |
| client\_id | The Client ID which should be used. | `string` | n/a | yes |
| client\_secret | The Client Secret which should be used. | `string` | n/a | yes |
| resource\_group\_name | Specifies the Name of the Resource Group within which this database will reside. | `string` | n/a | yes |
| subnet\_name | The name of the Subnet from which Private IP Addresses will be allocated for this Private Endpoint. | `string` | n/a | yes |
| subscription\_id | The Subscription ID which should be used. | `string` | n/a | yes |
| tenant\_id | The Tenant ID which should be used. | `string` | n/a | yes |
| virtual\_network\_name | The name of the virtual network where Private Endpoint will be allocated. | `string` | n/a | yes |
| virtual\_network\_resource\_group\_name | Specifies the Name of the Resource Group within which the Private Endpoint should exist. | `string` | n/a | yes |
| name | Name of the example application. | `string` | `"hum-rp-postgres-example"` | no |
| prefix | Prefix of the created resources | `string` | `"hum-rp-postgres-ex-"` | no |
| resource\_packs\_azure\_rev | Azure Resource Pack git branch. | `string` | `"refs/heads/main"` | no |
| resource\_packs\_azure\_url | Azure Resource Pack git url. | `string` | `"https://github.com/humanitec-architecture/resource-packs-azure.git"` | no |
<!-- END_TF_DOCS -->
27 changes: 27 additions & 0 deletions examples/postgres/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
resource "humanitec_application" "example" {
id = var.name
name = var.name
}

module "postgres" {
source = "../../humanitec-resource-defs/postgres/basic"

prefix = var.prefix
resource_packs_azure_url = var.resource_packs_azure_url
resource_packs_azure_rev = var.resource_packs_azure_rev
client_id = var.client_id
client_secret = var.client_secret
tenant_id = var.tenant_id
subscription_id = var.subscription_id
resource_group_name = var.resource_group_name
administrator_login = var.administrator_login
administrator_login_password = var.administrator_login_password
virtual_network_name = var.virtual_network_name
virtual_network_resource_group_name = var.virtual_network_resource_group_name
subnet_name = var.subnet_name
}

resource "humanitec_resource_definition_criteria" "postgres" {
resource_definition_id = module.postgres.id
app_id = humanitec_application.example.id
}
13 changes: 13 additions & 0 deletions examples/postgres/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
terraform {
required_providers {
humanitec = {
source = "humanitec/humanitec"
version = "~> 0"
}
}

required_version = ">= 1.3.0"
}

provider "humanitec" {
}
42 changes: 42 additions & 0 deletions examples/postgres/terraform.tfvars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

# The Administrator login for the PostgreSQL Server.
administrator_login = ""

# The Password associated with the administrator_login for the PostgreSQL Server.
administrator_login_password = ""

# The Client ID which should be used.
client_id = ""

# The Client Secret which should be used.
client_secret = ""

# Name of the example application.
name = "hum-rp-postgres-example"

# Prefix of the created resources
prefix = "hum-rp-postgres-ex-"

# Specifies the Name of the Resource Group within which this database will reside.
resource_group_name = ""

# Azure Resource Pack git branch.
resource_packs_azure_rev = "refs/heads/main"

# Azure Resource Pack git url.
resource_packs_azure_url = "https://github.com/humanitec-architecture/resource-packs-azure.git"

# The name of the Subnet from which Private IP Addresses will be allocated for this Private Endpoint.
subnet_name = ""

# The Subscription ID which should be used.
subscription_id = ""

# The Tenant ID which should be used.
tenant_id = ""

# The name of the virtual network where Private Endpoint will be allocated.
virtual_network_name = ""

# Specifies the Name of the Resource Group within which the Private Endpoint should exist.
virtual_network_resource_group_name = ""
73 changes: 73 additions & 0 deletions examples/postgres/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
variable "prefix" {
description = "Prefix of the created resources"
type = string
default = "hum-rp-postgres-ex-"
}

variable "name" {
description = "Name of the example application."
type = string
default = "hum-rp-postgres-example"
}

variable "resource_packs_azure_url" {
description = "Azure Resource Pack git url."
type = string
default = "https://github.com/humanitec-architecture/resource-packs-azure.git"
}

variable "resource_packs_azure_rev" {
description = "Azure Resource Pack git branch."
type = string
default = "refs/heads/main"
}

variable "client_id" {
description = "The Client ID which should be used."
type = string
}

variable "client_secret" {
description = "The Client Secret which should be used."
type = string
}

variable "tenant_id" {
description = "The Tenant ID which should be used."
type = string
}

variable "subscription_id" {
description = "The Subscription ID which should be used."
type = string
}

variable "resource_group_name" {
description = "Specifies the Name of the Resource Group within which this database will reside."
type = string
}

variable "administrator_login" {
description = "The Administrator login for the PostgreSQL Server."
type = string
}

variable "administrator_login_password" {
description = "The Password associated with the administrator_login for the PostgreSQL Server."
type = string
}

variable "virtual_network_name" {
description = "The name of the virtual network where Private Endpoint will be allocated."
type = string
}

variable "virtual_network_resource_group_name" {
description = "Specifies the Name of the Resource Group within which the Private Endpoint should exist."
type = string
}

variable "subnet_name" {
description = "The name of the Subnet from which Private IP Addresses will be allocated for this Private Endpoint."
type = string
}
2 changes: 1 addition & 1 deletion humanitec-resource-defs/dns/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
| client\_secret | The Client Secret which should be used. | `string` | n/a | yes |
| dns\_zone | The id of the hosted zone in which this record set will reside. | `string` | n/a | yes |
| prefix | Prefix for all resources. | `string` | n/a | yes |
| resource\_group\_name | The id of the hosted zone in which this record set will reside. | `string` | n/a | yes |
| resource\_group\_name | Specifies the Name of the Resource Group within which this dns will reside. | `string` | n/a | yes |
| subscription\_id | The Subscription ID which should be used. | `string` | n/a | yes |
| tenant\_id | The Tenant ID which should be used. | `string` | n/a | yes |
| resource\_packs\_azure\_rev | Azure Resource Pack git branch. | `string` | `"refs/heads/main"` | no |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dns_zone = ""
# Prefix for all resources.
prefix = ""

# The id of the hosted zone in which this record set will reside.
# Specifies the Name of the Resource Group within which this dns will reside.
resource_group_name = ""

# Azure Resource Pack git branch.
Expand Down
2 changes: 1 addition & 1 deletion humanitec-resource-defs/dns/basic/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ variable "dns_zone" {
}

variable "resource_group_name" {
description = "The id of the hosted zone in which this record set will reside."
description = "Specifies the Name of the Resource Group within which this dns will reside."
type = string
}
54 changes: 54 additions & 0 deletions humanitec-resource-defs/postgres/basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| terraform | >= 1.3.0 |
| humanitec | ~> 0 |

## Providers

| Name | Version |
|------|---------|
| humanitec | ~> 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 |
|------|-------------|------|---------|:--------:|
| administrator\_login | The Administrator login for the PostgreSQL Server. | `string` | n/a | yes |
| administrator\_login\_password | The Password associated with the administrator\_login for the PostgreSQL Server. | `string` | n/a | yes |
| client\_id | The Client ID which should be used. | `string` | n/a | yes |
| client\_secret | The Client Secret which should be used. | `string` | n/a | yes |
| resource\_group\_name | Specifies the Name of the Resource Group within which this database will reside. | `string` | n/a | yes |
| subnet\_name | The name of the Subnet from which Private IP Addresses will be allocated for this Private Endpoint. | `string` | n/a | yes |
| subscription\_id | The Subscription ID which should be used. | `string` | n/a | yes |
| tenant\_id | The Tenant ID which should be used. | `string` | n/a | yes |
| virtual\_network\_name | The name of the virtual network where Private Endpoint will be allocated. | `string` | n/a | yes |
| virtual\_network\_resource\_group\_name | Specifies the Name of the Resource Group within which the Private Endpoint should exist. | `string` | n/a | yes |
| auto\_grow\_enabled | Enable/Disable auto-growing of the storage. Storage auto-grow prevents your server from running out of storage and becoming read-only. | `bool` | `true` | no |
| backup\_retention\_days | Backup retention days for the server, supported values are between 7 and 35 days. | `number` | `7` | no |
| geo\_redundant\_backup\_enabled | Turn Geo-redundant server backups on/off. | `bool` | `true` | no |
| name | Specifies the Name for created resources. (Leave empty for the default one) | `string` | `""` | no |
| postgres\_version | Specifies the version of PostgreSQL to use. | `string` | `"11"` | no |
| prefix | Specifies the prefix used in default name for created resources. | `string` | `"hum-rp-postgres-ex-"` | no |
| public\_network\_access\_enabled | Whether or not public network access is allowed for this server. | `bool` | `false` | no |
| resource\_packs\_azure\_rev | Azure Resource Pack git branch. | `string` | `"refs/heads/main"` | no |
| resource\_packs\_azure\_url | Azure Resource Pack git url. | `string` | `"https://github.com/humanitec-architecture/resource-packs-aws.git"` | no |
| sku\_name | Specifies the SKU Name for this PostgreSQL Server. | `string` | `"GP_Gen5_4"` | no |
| ssl\_enforcement\_enabled | Specifies if SSL should be enforced on connections. | `bool` | `true` | no |
| ssl\_minimal\_tls\_version\_enforced | The minimum TLS version to support on the sever. | `string` | `"TLS1_2"` | no |
| storage\_mb | Max storage allowed for a server. | `number` | `640000` | no |

## Outputs

| Name | Description |
|------|-------------|
| id | n/a |
<!-- END_TF_DOCS -->
Loading
Loading