File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ data "template_file" "mongod_task_config" {
29
29
container_name = " mongod-server"
30
30
mongo_version = " ${ var . mongodb_version } "
31
31
mongo_container_memory = " ${ var . mongod_memory_limit } "
32
+ mongo_password = " ${ var . mongodb_password } "
33
+ mongo_username = " ${ var . mongodb_username } "
34
+ mongo_database = " ${ var . mongodb_database } "
32
35
native_transport_port = " ${ var . mongod_port } "
33
36
volume_name = " mongo-data"
34
37
}
Original file line number Diff line number Diff line change 1
1
[
2
2
{
3
3
"name" : " ${container_name}" ,
4
- "image" : " mongo :${mongo_version}" ,
4
+ "image" : " bitnami/mongodb :${mongo_version}" ,
5
5
"memory" : ${mongo_container_memory },
6
6
"essential" : true ,
7
7
"portMappings" : [
11
11
"protocol" : " tcp"
12
12
}
13
13
],
14
- "environment" : [],
14
+ "environment" : [
15
+ { "name" : " MONGODB_USERNAME" , "value" : " ${mongo_username}" },
16
+ { "name" : " MONGODB_ROOT_PASSWORD" , "value" : " ${mongo_password}" },
17
+ { "name" : " MONGODB_DATABASE" , "value" : " ${mongo_database}" }
18
+ ],
15
19
"mountPoints" : [
16
20
{
17
21
"sourceVolume" : " ${volume_name}" ,
18
- "containerPath" : " /data/db " ,
22
+ "containerPath" : " /bitnami " ,
19
23
"readOnly" : false
20
24
}
21
25
],
Original file line number Diff line number Diff line change @@ -83,7 +83,21 @@ variable "trusted_networks" {
83
83
84
84
variable "mongodb_version" {
85
85
type = " string"
86
- default = " 3.0.15"
86
+ default = " 3"
87
+ }
88
+
89
+ variable "mongodb_password" {
90
+ type = " string"
91
+ }
92
+
93
+
94
+ variable "mongodb_username" {
95
+ type = " string"
96
+ }
97
+
98
+
99
+ variable "mongodb_database" {
100
+ type = " string"
87
101
}
88
102
89
103
variable "mongod_port" {
You can’t perform that action at this time.
0 commit comments