-
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.
Merge pull request #108 from yunkon-kim/241114-14
Align the `sql_db_info` output of AWS, Azure, GCP, and NCP
- Loading branch information
Showing
21 changed files
with
593 additions
and
144 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 |
---|---|---|
@@ -1,7 +1,54 @@ | ||
#outputs.tf | ||
output "security_group_id" { | ||
value = aws_security_group.rds_sg.id | ||
} | ||
output "db_instance_endpoint" { | ||
value = aws_db_instance.myinstance.endpoint | ||
# Outputs wrapped in sql_db_info object | ||
output "sql_db_info" { | ||
description = "Information for connecting to the MySQL RDS instance with dynamic variables." | ||
value = { | ||
sql_db_detail = { | ||
# Basic Information | ||
instance_name = aws_db_instance.myinstance.identifier # "myrdsinstance" | ||
instance_resource_id = aws_db_instance.myinstance.id # "db-YMJCVDFDANINUTBJJU63AZTY5Q" | ||
instance_spec = aws_db_instance.myinstance.instance_class # "db.t3.micro" | ||
location = aws_db_instance.myinstance.availability_zone # "ap-northeast-2c" | ||
tags = aws_db_instance.myinstance.tags # { "Name" = "myrdsinstance" } | ||
|
||
# Storage Configuration | ||
storage_type = aws_db_instance.myinstance.storage_type # "gp2" | ||
storage_size = aws_db_instance.myinstance.allocated_storage # 20 | ||
|
||
# Database Engine Information | ||
engine_name = aws_db_instance.myinstance.engine # "mysql" | ||
engine_version = aws_db_instance.myinstance.engine_version # "8.0.39" | ||
|
||
# Database Connection Details | ||
connection_endpoint = aws_db_instance.myinstance.endpoint # "myrdsinstance.chrkjg2ktom1.ap-northeast-2.rds.amazonaws.com:3306" | ||
connection_host = aws_db_instance.myinstance.address # "myrdsinstance.chrkjg2ktom1.ap-northeast-2.rds.amazonaws.com" | ||
connection_port = aws_db_instance.myinstance.port # 3306 | ||
public_access_enabled = aws_db_instance.myinstance.publicly_accessible # true | ||
|
||
# Authentication | ||
admin_username = aws_db_instance.myinstance.username # "myrdsuser" | ||
# amdin_password = aws_db_instance.myinstance.password # "myrdsuser" | ||
|
||
provider_specific_detail = { | ||
provider = "aws" | ||
resource_identifier = aws_db_instance.myinstance.arn # "arn:aws:rds:ap-northeast-2:635484366616:db:myrdsinstance" | ||
is_multi_az = aws_db_instance.myinstance.multi_az # false | ||
|
||
status = aws_db_instance.myinstance.status # "available" | ||
dns_zone_id = aws_db_instance.myinstance.hosted_zone_id # "ZLA2NUCOLGUUR" | ||
security_group_ids = aws_db_instance.myinstance.vpc_security_group_ids # ["sg-0af75bda5c889cea6"] | ||
subnet_group_name = aws_db_instance.myinstance.db_subnet_group_name # "tofu-main" | ||
storage_encrypted = aws_db_instance.myinstance.storage_encrypted # false | ||
storage_throughput = aws_db_instance.myinstance.storage_throughput # 0 | ||
storage_iops = aws_db_instance.myinstance.iops # 0 | ||
replicas = aws_db_instance.myinstance.replicas # [] | ||
} | ||
} | ||
} | ||
} | ||
|
||
# | ||
# output "db_instance_all" { | ||
# description = "All information" | ||
# value = aws_db_instance.myinstance | ||
# sensitive = true | ||
# } |
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 |
---|---|---|
@@ -1,12 +1,64 @@ | ||
output "MySqlDbInfo" { | ||
description = "Information needed to connect and manage the Azure Database for MySQL instance." | ||
# Outputs wrapped in sql_db_info object | ||
output "sql_db_info" { | ||
description = "Information for connecting to the MySQL Flexible Server instance in Azure." | ||
value = { | ||
server_name = azurerm_mysql_flexible_server.example.name | ||
fully_qualified_domain_name = azurerm_mysql_flexible_server.example.fqdn | ||
administrator_login = azurerm_mysql_flexible_server.example.administrator_login | ||
administrator_password = "YOUR_PASSWORD_HERE" # Note: Avoid exposing this directly; consider using a secret management tool | ||
database_name = azurerm_mysql_flexible_database.example.name | ||
port = 3306 | ||
# ssl_enforcement = azurerm_mysql_flexible_server.example.ssl_enforcement_enabled | ||
sql_db_detail = { | ||
# Basic Information | ||
instance_name = azurerm_mysql_flexible_server.example.name # "tofu-example-mysql-server" | ||
instance_resource_id = azurerm_mysql_flexible_server.example.id # "/subscriptions/a20fed83-96bd-4480-92a9-140b8e3b7c3a/resourceGroups/tofu-example-rg/providers/Microsoft.DBforMySQL/flexibleServers/tofu-example-mysql-server" | ||
instance_spec = azurerm_mysql_flexible_server.example.sku_name # "B_Standard_B1ms" | ||
location = azurerm_mysql_flexible_server.example.location # "koreacentral" | ||
tags = azurerm_mysql_flexible_server.example.tags # (if available) | ||
|
||
# Storage Configuration | ||
storage_type = "Premium_LRS" # Azure MySQL Flexible Server uses Premium storage | ||
storage_size = azurerm_mysql_flexible_server.example.storage[0].size_gb # 20 | ||
|
||
# Database Engine Information | ||
engine_name = "mysql" # Always "mysql" | ||
engine_version = azurerm_mysql_flexible_server.example.version # "5.7" | ||
|
||
# Database Connection Details | ||
connection_endpoint = "${azurerm_mysql_flexible_server.example.fqdn}:3306" # "tofu-example-mysql-server.mysql.database.azure.com:3306" | ||
connection_host = azurerm_mysql_flexible_server.example.fqdn # "tofu-example-mysql-server.mysql.database.azure.com" | ||
connection_port = 3306 # Default MySQL port | ||
public_access_enabled = azurerm_mysql_flexible_server.example.public_network_access_enabled # true | ||
|
||
# Authentication | ||
admin_username = azurerm_mysql_flexible_server.example.administrator_login # "adminuser" | ||
# admin_password = azurerm_mysql_flexible_server.example.administrator_login_password # "adminuser" | ||
|
||
provider_specific_detail = { | ||
provider = "azure" | ||
resource_identifier = azurerm_mysql_flexible_server.example.id | ||
|
||
resource_group_name = azurerm_mysql_flexible_server.example.resource_group_name # "tofu-example-rg" | ||
zone = azurerm_mysql_flexible_server.example.zone # "2" | ||
database_name = azurerm_mysql_flexible_database.example.name # "tofu-example-db" | ||
charset = azurerm_mysql_flexible_database.example.charset # "utf8" | ||
collation = azurerm_mysql_flexible_database.example.collation # "utf8_general_ci" | ||
|
||
storage_autogrow_enabled = azurerm_mysql_flexible_server.example.storage[0].auto_grow_enabled # true | ||
io_scaling_enabled = azurerm_mysql_flexible_server.example.storage[0].io_scaling_enabled # false | ||
|
||
backup_retention_days = azurerm_mysql_flexible_server.example.backup_retention_days # 7 | ||
geo_redundant_backup_enabled = azurerm_mysql_flexible_server.example.geo_redundant_backup_enabled # false | ||
|
||
replica_capacity = azurerm_mysql_flexible_server.example.replica_capacity # 10 | ||
replication_role = azurerm_mysql_flexible_server.example.replication_role # "None" | ||
} | ||
} | ||
} | ||
} | ||
|
||
# output "azurerm_mysql_flexible_server_all" { | ||
# description = "All attributes of the Azure Database for MySQL instance." | ||
# value = azurerm_mysql_flexible_server.example | ||
# sensitive = true | ||
# } | ||
|
||
# output "azurerm_mysql_flexible_database_all" { | ||
# description = "All attributes of the Azure Database for MySQL database." | ||
# value = azurerm_mysql_flexible_database.example | ||
# sensitive = true | ||
# } |
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 |
---|---|---|
@@ -1,11 +1,59 @@ | ||
# Outputs wrapped in SqlDbInstanceInfo object, including public IP | ||
output "SqlDbInstanceInfo" { | ||
# Outputs wrapped in sql_db_info object | ||
output "sql_db_info" { | ||
description = "Information of the MySQL Cloud SQL instance in GCP." | ||
value = { | ||
instance_name = google_sql_database_instance.my_sql_instance.name | ||
database_name = google_sql_database.my_database.name | ||
database_user = google_sql_user.my_user.name | ||
connection_name = google_sql_database_instance.my_sql_instance.connection_name | ||
public_ip = google_sql_database_instance.my_sql_instance.public_ip_address | ||
sql_db_detail = { | ||
# Basic Information | ||
instance_name = google_sql_database_instance.my_sql_instance.name # "my-sql-instance" | ||
instance_resource_id = google_sql_database_instance.my_sql_instance.id # "my-sql-instance" | ||
instance_spec = google_sql_database_instance.my_sql_instance.settings[0].tier # "db-f1-micro" | ||
location = google_sql_database_instance.my_sql_instance.settings[0].location_preference[0].zone # "asia-northeast3-a" | ||
tags = google_sql_database_instance.my_sql_instance.settings[0].user_labels # {} | ||
|
||
# Storage Configuration | ||
storage_type = google_sql_database_instance.my_sql_instance.settings[0].disk_type # "PD_SSD" | ||
storage_size = google_sql_database_instance.my_sql_instance.settings[0].disk_size # 10 | ||
|
||
# Database Engine Information | ||
engine_name = "mysql" # Not exposed by GCP | ||
engine_version = google_sql_database_instance.my_sql_instance.database_version # "MYSQL_8_0" | ||
|
||
# Database Connection Details | ||
connection_endpoint = "${google_sql_database_instance.my_sql_instance.first_ip_address}:3306" | ||
connection_host = google_sql_database_instance.my_sql_instance.first_ip_address | ||
connection_port = 3306 # Default MySQL port | ||
public_access_enabled = google_sql_database_instance.my_sql_instance.settings[0].ip_configuration[0].ipv4_enabled | ||
|
||
# Authentication | ||
admin_username = google_sql_user.my_user.name # "myuser" | ||
# admin_password = google_sql_user.my_user.password # "mypassword" | ||
|
||
provider_specific_detail = { | ||
provider = "gcp" | ||
resource_identifier = google_sql_database_instance.my_sql_instance.self_link | ||
availability_type = google_sql_database_instance.my_sql_instance.settings[0].availability_type | ||
|
||
project = google_sql_database_instance.my_sql_instance.project | ||
region = google_sql_database_instance.my_sql_instance.region | ||
} | ||
} | ||
} | ||
description = "Information for SQL Database instance, including instance name, database name, user, connection name, and public IP address" | ||
} | ||
|
||
# output "my_sql_instance_all" { | ||
# description = "All information" | ||
# value = google_sql_database_instance.my_sql_instance | ||
# sensitive = true | ||
# } | ||
|
||
# output "my_database_all" { | ||
# description = "All information" | ||
# value = google_sql_database.my_database | ||
# sensitive = true | ||
# } | ||
|
||
# output "my_user_all" { | ||
# description = "All information" | ||
# value = google_sql_user.my_user | ||
# sensitive = true | ||
# } |
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 |
---|---|---|
@@ -1,12 +1,67 @@ | ||
output "mysql_db_info" { | ||
description = "Information needed to connect to the MySQL RDS instance." | ||
# Outputs wrapped in sql_db_info object | ||
output "sql_db_info" { | ||
description = "Information for connecting to the MySQL instance in NCP." | ||
value = { | ||
service_name = ncloud_mysql.mysql.service_name | ||
server_name_prefix = ncloud_mysql.mysql.server_name_prefix | ||
user_name = ncloud_mysql.mysql.user_name | ||
host_ip = ncloud_mysql.mysql.host_ip | ||
database_name = ncloud_mysql.mysql.database_name | ||
# user_password = ncloud_mysql.mysql.user_password | ||
sql_db_detail = { | ||
# Basic Information | ||
instance_name = ncloud_mysql.mysql.service_name # "tofu-example-mysql" | ||
instance_resource_id = ncloud_mysql.mysql.id # "100457839" | ||
instance_spec = ncloud_mysql.mysql.image_product_code # "SW.VMYSL.OS.LNX64.ROCKY.0810.MYSQL.B050" | ||
location = ncloud_mysql.mysql.region_code # "KR" | ||
tags = {} # (if available) | ||
|
||
# Storage Configuration | ||
storage_type = ncloud_mysql.mysql.data_storage_type # "SSD" | ||
storage_size = ncloud_mysql.mysql.mysql_server_list[0].data_storage_size / 1073741824 # 10 (Unit: GB) | ||
|
||
# Database Engine Information | ||
engine_name = "mysql" # Always "mysql" | ||
engine_version = ncloud_mysql.mysql.engine_version_code # "MYSQL8.0.36" | ||
|
||
# Database Connection Details | ||
connection_endpoint = "${ncloud_mysql.mysql.mysql_server_list[0].private_domain}:${ncloud_mysql.mysql.port}" # "db-2vpnbg.vpc-cdb.ntruss.com:3306" | ||
connection_host = ncloud_mysql.mysql.mysql_server_list[0].private_domain # "db-2vpnbg.vpc-cdb.ntruss.com" | ||
connection_port = ncloud_mysql.mysql.port # 3306 | ||
public_access_enabled = ncloud_mysql.mysql.mysql_server_list[0].is_public_subnet # true | ||
|
||
# Authentication | ||
admin_username = ncloud_mysql.mysql.user_name # "username" | ||
# admin_password = ncloud_mysql.mysql.user_password # "password" | ||
|
||
provider_specific_detail = { | ||
provider = "ncp" | ||
resource_identifier = ncloud_mysql.mysql.id # "100457839" | ||
is_ha = ncloud_mysql.mysql.is_ha # true | ||
|
||
host_ip = ncloud_mysql.mysql.host_ip # "%" | ||
server_name_prefix = ncloud_mysql.mysql.server_name_prefix # "tofu-example-prefix" | ||
server_instances = [for server in ncloud_mysql.mysql.mysql_server_list : { | ||
name = server.server_name # "tofu-example-prefix-001-61we" | ||
role = server.server_role # "M" or "H" | ||
cpu_count = server.cpu_count # 2 | ||
memory_size = server.memory_size # 4294967296 | ||
create_date = server.create_date # "2024-11-14T19:29:51+0900" | ||
uptime = server.uptime # "2024-11-14T19:34:37+0900" | ||
server_instance_no = server.server_instance_no # "100457840" | ||
}] | ||
|
||
vpc_no = ncloud_mysql.mysql.vpc_no # "82836" | ||
subnet_no = ncloud_mysql.mysql.subnet_no # "185880" | ||
access_control_group_no_list = ncloud_mysql.mysql.access_control_group_no_list # ["218311"] | ||
|
||
backup_enabled = ncloud_mysql.mysql.is_backup # true | ||
backup_time = ncloud_mysql.mysql.backup_time # "07:45" | ||
backup_file_retention_period = ncloud_mysql.mysql.backup_file_retention_period # 1 | ||
|
||
is_multi_zone = ncloud_mysql.mysql.is_multi_zone # false | ||
is_storage_encryption = ncloud_mysql.mysql.is_storage_encryption # false | ||
} | ||
} | ||
} | ||
# sensitive = true // Mark as sensitive to hide sensitive details like passwords | ||
} | ||
|
||
# output "ncloud_mysql_all" { | ||
# description = "All information about the MySQL RDS instance." | ||
# value = ncloud_mysql.mysql | ||
# sensitive = true // Mark as sensitive to hide sensitive details like passwords | ||
# } |
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.