Skip to content

Commit

Permalink
Merge pull request #21 from terraform-yacloud-modules/output
Browse files Browse the repository at this point in the history
Переработал output
  • Loading branch information
patsevanton authored Aug 3, 2024
2 parents 014093c + 66569c8 commit e278d00
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.0
rev: v1.92.1
hooks:
- id: terraform_fmt
- id: terraform_validate
Expand All @@ -23,7 +23,7 @@ repos:
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
69 changes: 69 additions & 0 deletions examples/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
output "id" {
description = "The ID of the MySQL cluster"
value = module.mysql.id
}

output "name" {
description = "The name of the MySQL cluster"
value = module.mysql.name
}

output "fqdn" {
description = "The fully qualified domain name of the MySQL cluster"
value = module.mysql.fqdn
}

output "hosts" {
description = "List of host FQDNs in the MySQL cluster"
value = module.mysql.hosts
}

output "network_id" {
description = "The ID of the network to which the MySQL cluster belongs"
value = module.mysql.network_id
}

output "security_group_id" {
description = "The ID of the security group assigned to the MySQL cluster"
value = module.mysql.security_group_id
}

output "environment" {
description = "The deployment environment of the MySQL cluster"
value = module.mysql.environment
}

output "version" {
description = "The version of the MySQL cluster"
value = module.mysql.version
}

output "resources" {
description = "The resources allocated to the MySQL cluster"
value = module.mysql.resources
}

output "maintenance_window" {
description = "The maintenance window settings of the MySQL cluster"
value = module.mysql.maintenance_window
}

output "backup_window_start" {
description = "The backup window start time of the MySQL cluster"
value = module.mysql.backup_window_start
}

output "backup_retain_period_days" {
description = "The number of days to retain backups for the MySQL cluster"
value = module.mysql.backup_retain_period_days
}

output "access" {
description = "The access settings of the MySQL cluster"
value = module.mysql.access
}

output "performance_diagnostics" {
description = "The performance diagnostics settings of the MySQL cluster"
value = module.mysql.performance_diagnostics
}
92 changes: 78 additions & 14 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,24 +1,88 @@
output "db_info" {
value = yandex_mdb_mysql_cluster.mysql
description = "Full information about the cluster"
output "id" {
description = "The ID of the MySQL cluster"
value = yandex_mdb_mysql_cluster.mysql.id
}

output "hosts_fqdn" {
output "name" {
description = "The name of the MySQL cluster"
value = yandex_mdb_mysql_cluster.mysql.name
}

output "fqdn" {
description = "The fully qualified domain name of the MySQL cluster"
value = "c-${yandex_mdb_mysql_cluster.mysql.id}.rw.mdb.yandexcloud.net"
}

output "hosts" {
description = "List of host FQDNs in the MySQL cluster"
value = [for host in yandex_mdb_mysql_cluster.mysql.host : host.fqdn]
description = "List of server FQDN"
}

output "hosts_name" {
value = [for host in yandex_mdb_mysql_cluster.mysql.host : host.name]
description = "List of server names"
output "network_id" {
description = "The ID of the network to which the MySQL cluster belongs"
value = yandex_mdb_mysql_cluster.mysql.network_id
}

output "id" {
value = yandex_mdb_mysql_cluster.mysql.id
description = "cluster ID"
output "security_group_id" {
description = "The ID of the security group assigned to the MySQL cluster"
value = yandex_vpc_security_group.mysql.id
}

output "name" {
value = yandex_mdb_mysql_cluster.mysql.name
description = "cluster name"
output "environment" {
description = "The deployment environment of the MySQL cluster"
value = yandex_mdb_mysql_cluster.mysql.environment
}

output "version" {
description = "The version of the MySQL cluster"
value = yandex_mdb_mysql_cluster.mysql.version
}

output "resources" {
description = "The resources allocated to the MySQL cluster"
value = {
resource_preset_id = yandex_mdb_mysql_cluster.mysql.resources[0].resource_preset_id
disk_type_id = yandex_mdb_mysql_cluster.mysql.resources[0].disk_type_id
disk_size = yandex_mdb_mysql_cluster.mysql.resources[0].disk_size
}
}

output "maintenance_window" {
description = "The maintenance window settings of the MySQL cluster"
value = {
type = yandex_mdb_mysql_cluster.mysql.maintenance_window[0].type
day = yandex_mdb_mysql_cluster.mysql.maintenance_window[0].day
hour = yandex_mdb_mysql_cluster.mysql.maintenance_window[0].hour
}
}

output "backup_window_start" {
description = "The backup window start time of the MySQL cluster"
value = {
hours = yandex_mdb_mysql_cluster.mysql.backup_window_start[0].hours
minutes = yandex_mdb_mysql_cluster.mysql.backup_window_start[0].minutes
}
}

output "backup_retain_period_days" {
description = "The number of days to retain backups for the MySQL cluster"
value = yandex_mdb_mysql_cluster.mysql.backup_retain_period_days
}

output "access" {
description = "The access settings of the MySQL cluster"
value = {
data_lens = yandex_mdb_mysql_cluster.mysql.access[0].data_lens
web_sql = yandex_mdb_mysql_cluster.mysql.access[0].web_sql
data_transfer = yandex_mdb_mysql_cluster.mysql.access[0].data_transfer
}
}

output "performance_diagnostics" {
description = "The performance diagnostics settings of the MySQL cluster"
value = {
enabled = yandex_mdb_mysql_cluster.mysql.performance_diagnostics[0].enabled
sessions_sampling_interval = yandex_mdb_mysql_cluster.mysql.performance_diagnostics[0].sessions_sampling_interval
statements_sampling_interval = yandex_mdb_mysql_cluster.mysql.performance_diagnostics[0].statements_sampling_interval
}
}

0 comments on commit e278d00

Please sign in to comment.