1
+ locals {
2
+ shared_env_vars = {
3
+ " SECRET_KEY" = var.secret_key
4
+ " LOG_LEVEL" = " INFO"
5
+ " CONSOLE_WEB_URL" = " "
6
+ " CONSOLE_API_URL" = " "
7
+ " SERVICE_API_URL" = " "
8
+ " APP_WEB_URL" = " "
9
+ " CHECK_UPDATE_URL" = " https://updates.dify.ai"
10
+ " OPENAI_API_BASE" = " https://api.openai.com/v1"
11
+ " FILES_URL" = " "
12
+ " MIGRATION_ENABLED" = " true"
13
+ " CELERY_BROKER_URL" = " redis://${ module . redis . redis_host } :${ module . redis . redis_port } /1"
14
+ " WEB_API_CORS_ALLOW_ORIGINS" = " *"
15
+ " CONSOLE_CORS_ALLOW_ORIGINS" = " *"
16
+ " DB_USERNAME" = var.db_username
17
+ " DB_PASSWORD" = var.db_password
18
+ " DB_HOST" = module.cloudsql.cloudsql_internal_ip
19
+ " DB_PORT" = var.db_port
20
+ " DB_DATABASE" = var.db_database
21
+ " STORAGE_TYPE" = var.storage_type
22
+ " GOOGLE_STORAGE_BUCKET_NAME" = module.storage.storage_bucket_name
23
+ " GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64" = module.storage.storage_admin_key_base64
24
+ " REDIS_HOST" = module.redis.redis_host
25
+ " REDIS_PORT" = module.redis.redis_port
26
+ " VECTOR_STORE" = var.vector_store
27
+ " PGVECTOR_HOST" = module.cloudsql.cloudsql_internal_ip
28
+ " PGVECTOR_PORT" = " 5432"
29
+ " PGVECTOR_USER" = var.db_username
30
+ " PGVECTOR_PASSWORD" = var.db_password
31
+ " PGVECTOR_DATABASE" = var.db_database
32
+ " CODE_EXECUTION_ENDPOINT" = module.cloudrun.dify_sandbox_url
33
+ " CODE_EXECUTION_API_KEY" = " dify-sandbox"
34
+ " INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH" = var.indexing_max_segmentation_tokens_length
35
+ " PLUGIN_DAEMON_KEY" = var.plugin_daemon_key
36
+ " PLUGIN_DIFY_INNER_API_KEY" = var.plugin_dify_inner_api_key
37
+ }
38
+ }
39
+
1
40
module "cloudrun" {
2
41
source = " ../../modules/cloudrun"
3
42
4
- project_id = var. project_id
5
- region = var. region
6
- dify_version = var. dify_version
7
- dify_sandbox_version = var. dify_sandbox_version
8
- cloud_run_ingress = var. cloud_run_ingress
9
- nginx_repository_id = var. nginx_repository_id
10
- web_repository_id = var. web_repository_id
11
- api_repository_id = var. api_repository_id
12
- sandbox_repository_id = var. sandbox_repository_id
13
- secret_key = var. secret_key
14
- db_username = var. db_username
15
- db_password = var. db_password
16
- db_host = module. cloudsql . cloudsql_internal_ip
17
- db_port = var. db_port
18
- db_database = var. db_database
19
- storage_type = var. storage_type
20
- vector_store = var. vector_store
21
- indexing_max_segmentation_tokens_length = var. indexing_max_segmentation_tokens_length
22
-
23
- vpc_network_name = module. network . vpc_network_name
24
- redis_host = module. redis . redis_host
25
- redis_port = module. redis . redis_port
26
- google_storage_service_account_json_base64 = module. storage . storage_admin_key_base64
27
- google_storage_bucket_name = module. storage . storage_bucket_name
28
-
43
+ project_id = var. project_id
44
+ region = var. region
45
+ dify_version = var. dify_version
46
+ dify_sandbox_version = var. dify_sandbox_version
47
+ cloud_run_ingress = var. cloud_run_ingress
48
+ nginx_repository_id = var. nginx_repository_id
49
+ web_repository_id = var. web_repository_id
50
+ api_repository_id = var. api_repository_id
51
+ sandbox_repository_id = var. sandbox_repository_id
52
+ vpc_network_name = module. network . vpc_network_name
53
+ vpc_subnet_name = module. network . vpc_subnet_name
54
+ plugin_daemon_repository_id = var. plugin_daemon_repository_id
55
+ plugin_daemon_key = var. plugin_daemon_key
56
+ plugin_dify_inner_api_key = var. plugin_dify_inner_api_key
57
+ dify_plugin_daemon_version = var. dify_plugin_daemon_version
58
+ shared_env_vars = local. shared_env_vars
29
59
}
30
60
31
61
module "cloudsql" {
@@ -66,12 +96,13 @@ module "storage" {
66
96
module "registry" {
67
97
source = " ../../modules/registry"
68
98
69
- project_id = var. project_id
70
- region = var. region
71
- nginx_repository_id = var. nginx_repository_id
72
- web_repository_id = var. web_repository_id
73
- api_repository_id = var. api_repository_id
74
- sandbox_repository_id = var. sandbox_repository_id
99
+ project_id = var. project_id
100
+ region = var. region
101
+ nginx_repository_id = var. nginx_repository_id
102
+ web_repository_id = var. web_repository_id
103
+ api_repository_id = var. api_repository_id
104
+ sandbox_repository_id = var. sandbox_repository_id
105
+ plugin_daemon_repository_id = var. plugin_daemon_repository_id
75
106
}
76
107
77
108
locals {
@@ -90,4 +121,4 @@ resource "google_project_service" "enabled_services" {
90
121
for_each = toset (local. services )
91
122
project = var. project_id
92
123
service = each. value
93
- }
124
+ }
0 commit comments