-
Notifications
You must be signed in to change notification settings - Fork 7
Cosmos DB module #208
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
Cosmos DB module #208
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looking good! Left some suggestions.
@@ -0,0 +1,23 @@ | |||
resource "azurerm_cosmosdb_account" "db" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yito88 Can you take a look at this Cosmos DB configuration if it is OK?
# cluster_auto_scaling_max_count = "6" | ||
} | ||
|
||
# enable_cosmosdb_service_endpoint = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the variable name is a little too specific to what it actually does instead of what users want.
How about enable_cosmosdb
or use_cosmosdb
? (I think the latter sounds good to me since a user simply declares that he/she uses it.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use_cosmosdb
sounds good to me too. I'll update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modules/azure/cosmosdb/main.tf
Outdated
resource_group_name = local.network_name | ||
offer_type = "Standard" | ||
|
||
enable_automatic_failover = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to set enable_automatic_failover
false
for now.
First, It will not be enabled since Scalar DB doesn't support multiple regions now. (Strong consistency isn't supported with multiple regions.)
Though I'm not sure what happens when this failover, according to the document, the write region will be changed automatically. I guess it is possible to cause inconsistency for Scalar DB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Updated in 87ea970.
Co-authored-by: Hiroyuki Yamada <mogwaing@gmail.com>
name = "${local.network_name}-cosmosdb" | ||
location = local.region | ||
resource_group_name = local.network_name | ||
offer_type = "Standard" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to specify the kind
?
kind = "GlobalDocumentDB"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in ffb11fc
|
||
output "cosmosdb_account_read_endpoints" { | ||
value = azurerm_cosmosdb_account.db.read_endpoints | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a reason for not writing a description
from below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I just forgot to update the descriptions! Updated in 5ad6b0d. Thanks.
modules/azure/cosmosdb/locals.tf
Outdated
node_pool_subnet_id = var.kubernetes.node_pool_subnet_id | ||
bastion_ip = var.network.bastion_ip | ||
internal_domain = var.network.internal_domain | ||
triggers = [var.network.bastion_provision_id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
network_dns
network_id
bastion_ip
internal_domain
triggers
If not using, I think we can delete its.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Removed unnecessary variables in 550394d.
modules/azure/cosmosdb/README.md
Outdated
| cosmosdb_account_primary_master_key | n/a | | ||
| cosmosdb_account_primary_readonly_master_key | n/a | | ||
| cosmosdb_account_read_endpoints | n/a | | ||
| cosmosdb_account_secondary_master_key | n/a | | ||
| cosmosdb_account_secondary_readonly_master_key | n/a | | ||
| cosmosdb_account_write_endpoints | n/a | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the descriptions .
modules/azure/cosmosdb/output.tf
Outdated
|
||
output "cosmosdb_account_connection_strings" { | ||
value = azurerm_cosmosdb_account.db.connection_strings | ||
description = "A list of connection strings available for this CosmosDB account." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you use this
only here? not the
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was just a mistake. Thanks! Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@yito88 I will merge it but PTAL again ! |
https://scalar-labs.atlassian.net/browse/DLT-7024
azurerm_cosmosdb_account
resourceenable_cosmosdb_service_endpoint
to enable a service endpoint for Cosmos DB in a subnet that the kubernetes module creates