Skip to content

Commit

Permalink
chores(syntax): Fix formatting. (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit-garcia authored Feb 7, 2023
1 parent 9908775 commit 45183f4
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 43 deletions.
32 changes: 16 additions & 16 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
resource "random_password" "this" {
count = var.user_password != null ? 0 : 1

length = 16
min_lower = 1
length = 16
min_lower = 1
min_numeric = 1
min_special = 1
min_upper = 1
special = true
min_upper = 1
special = true
}

resource "scaleway_rdb_instance" "this" {
engine = var.engine
is_ha_cluster = var.ha_enabled
name = var.name
node_type = var.node_type
engine = var.engine
is_ha_cluster = var.ha_enabled
name = var.name
node_type = var.node_type

volume_size_in_gb = var.volume_size_in_gb
volume_type = var.volume_type
volume_size_in_gb = var.volume_size_in_gb
volume_type = var.volume_type

user_name = var.user_name
password = var.user_password != null ? var.user_password : random_password.this[0].result
user_name = var.user_name
password = var.user_password != null ? var.user_password : random_password.this[0].result

disable_backup = var.backup_disabled
backup_same_region = var.backup_same_region
backup_schedule_frequency = var.backup_schedule_frequency
backup_schedule_retention = var.backup_schedule_retention

region = var.region
project_id = var.project_id
tags = var.tags
region = var.region
project_id = var.project_id
tags = var.tags

dynamic "private_network" {
for_each = var.private_network != null ? [1] : []
content {
pn_id = try(var.private_network.pn_id, null)
pn_id = try(var.private_network.pn_id, null)
ip_net = try(var.private_network.ip_net, null)
}
}
Expand Down
8 changes: 4 additions & 4 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ output "instance_id" {

output "load_balancer" {
description = "List of load balancer endpoints of the database instance."
value = scaleway_rdb_instance.this.load_balancer
value = scaleway_rdb_instance.this.load_balancer
}

output "replicate_pn" {
description = "Private network attributes of the read replica."
value = scaleway_rdb_read_replica.this.*.private_network
value = scaleway_rdb_read_replica.this.*.private_network
}

output "user_password" {
description = "Password generated if non were given."
sensitive = true
value = try(random_password.this.0.result, null)
sensitive = true
value = try(random_password.this.0.result, null)
}
44 changes: 22 additions & 22 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
## Instance topology
variable "engine" {
description = "Database Instance's engine version (e.g. PostgreSQL-11)."
type = string
type = string
}

variable "ha_enabled" {
description = "Enable or disable high availability for the database instance."
type = bool
default = false
type = bool
default = false
}

variable "name" {
description = "Name of the Database Instance"
type = string
type = string
}

variable "node_type" {
description = "Type of database instance you want to create (e.g. db-dev-s)."
type = string
type = string
}

## Network
variable "private_network" {
description = "Describes the private network you want to connect to your cluster. If not set, a public network will be provided."
type = object({
pn_id = string
pn_id = string
ip_net = string
})
default = null
Expand All @@ -33,8 +33,8 @@ variable "private_network" {
## Storage
variable "volume_type" {
description = "Type of volume where data are stored (bssd or lssd)."
type = string
default = "lssd"
type = string
default = "lssd"

validation {
condition = contains(["bssd", "lssd"], var.volume_type)
Expand All @@ -44,39 +44,39 @@ variable "volume_type" {

variable "volume_size_in_gb" {
description = "Volume size (in GB) when volume_type is set to bssd. Must be a multiple of 5000000000."
type = number
default = null
type = number
default = null
}

## Backup
variable "backup_disabled" {
description = "Disable automated backup for the database instance."
type = bool
default = false
type = bool
default = false
}

variable "backup_same_region" {
description = "Whether logical backups are stored in the same region as the database instance."
type = bool
default = false
type = bool
default = false
}

variable "backup_schedule_frequency" {
description = "Backup schedule frequency in hours."
type = number
default = 24
type = number
default = 24
}

variable "backup_schedule_retention" {
description = "Backup schedule retention in days."
type = number
default = 7
type = number
default = 7
}

## User informations
variable "user_name" {
description = "Identifier for the first user of the database instance. **Warning** Changing the user_name will recreate the Database Instance."
type = string
type = string

validation {
condition = can(regex("^[-_a-zA-Z0-9]{1,63}$", var.user_name))
Expand All @@ -86,9 +86,9 @@ variable "user_name" {

variable "user_password" {
description = "Password for the first user of the database instance. A random password will be generated if null."
sensitive = true
type = string
default = null
sensitive = true
type = string
default = null
}

## Read replicas
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_version = ">= 0.13"
required_providers {
random = {
source = "hashicorp/random"
source = "hashicorp/random"
version = ">= 3.4.3"
}
scaleway = {
Expand Down

0 comments on commit 45183f4

Please sign in to comment.