File tree Expand file tree Collapse file tree 5 files changed +55
-11
lines changed
cfn-resources/custom-db-role/test Expand file tree Collapse file tree 5 files changed +55
-11
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ rm -rf inputs
1919mkdir inputs
2020
2121projectName=" ${1} "
22+ MONGODB_ATLAS_PROFILE=${MONGODB_ATLAS_PROFILE:- " default" }
2223projectId=$( atlas projects list --output json | jq --arg NAME " ${projectName} " -r ' .results[] | select(.name==$NAME) | .id' )
2324if [ -z " $projectId " ]; then
2425 projectId=$( atlas projects create " ${projectName} " --output=json | jq -r ' .id' )
3031
3132echo " Created project \" ${projectName} \" with id: ${projectId} "
3233
33- jq --arg projectId " $projectId " \
34- ' .ProjectId?|=$projectId ' \
35- " $( dirname " $0 " ) /inputs_1_create.template.json" > " inputs/inputs_1_create.json"
36-
37- jq --arg projectId " $projectId " \
38- ' .ProjectId?|=$projectId ' \
39- " $( dirname " $0 " ) /inputs_1_update.template.json" > " inputs/inputs_1_update.json"
34+ cd " $( dirname " $0 " ) " || exit
35+ WORDTOREMOVE=" template."
36+ for inputFile in inputs_* ; do
37+ outputFile=${inputFile// $WORDTOREMOVE / }
38+ jq --arg ProjectId " $projectId " --arg Profile " ${MONGODB_ATLAS_PROFILE} " \
39+ ' .ProjectId?|=$ProjectId | .Profile?|=$Profile' \
40+ " $inputFile " > " ../inputs/$outputFile "
41+ done
42+ cd ..
Original file line number Diff line number Diff line change 11{
2- "ProjectId" : " " ,
2+ "ProjectId" : " ${MONGODB_ATLAS_PROJECT_ID} " ,
33 "Actions" : [
44 {
55 "Action" : " FIND" ,
1212 }
1313 ],
1414 "RoleName" : " testcreate" ,
15- "Profile" : " default "
15+ "Profile" : " ${MONGODB_ATLAS_PROFILE} "
1616}
Original file line number Diff line number Diff line change 11{
2- "ProjectId" : " " ,
2+ "ProjectId" : " ${MONGODB_ATLAS_PROJECT_ID} " ,
33 "Actions" : [
44 {
55 "Action" : " FIND" ,
99 "DB" : " sample_airbnb"
1010 }
1111 ]
12+ },
13+ {
14+ "Action" : " INSERT" ,
15+ "Resources" : [
16+ {
17+ "Collection" : " listingsAndReviews" ,
18+ "DB" : " sample_airbnb"
19+ }
20+ ]
1221 }
1322 ],
1423 "RoleName" : " testcreate" ,
15- "Profile" : " default "
24+ "Profile" : " ${MONGODB_ATLAS_PROFILE} "
1625}
Original file line number Diff line number Diff line change 1+ {
2+ "ProjectId" : " ${MONGODB_ATLAS_PROJECT_ID}" ,
3+ "Actions" : [
4+ {
5+ "Action" : " FIND" ,
6+ "Resources" : [
7+ {
8+ "Collection" : " " ,
9+ "DB" : " "
10+ }
11+ ]
12+ }
13+ ],
14+ "RoleName" : " testcreate-cfn-empty-db" ,
15+ "Profile" : " ${MONGODB_ATLAS_PROFILE}"
16+ }
Original file line number Diff line number Diff line change 1+ {
2+ "ProjectId" : " ${MONGODB_ATLAS_PROJECT_ID}" ,
3+ "Actions" : [
4+ {
5+ "Action" : " INSERT" ,
6+ "Resources" : [
7+ {
8+ "Collection" : " " ,
9+ "DB" : " "
10+ }
11+ ]
12+ }
13+ ],
14+ "RoleName" : " testcreate-cfn-empty-db" ,
15+ "Profile" : " ${MONGODB_ATLAS_PROFILE}"
16+ }
You can’t perform that action at this time.
0 commit comments