-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50e063b
commit 48d1352
Showing
10 changed files
with
279 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
packages: | ||
- curl | ||
- gettext | ||
- mysql-client | ||
- postgresql-client | ||
- wget |
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
|
||
home="/home/vcap" | ||
#app_path="${home}/app" | ||
|
||
echo "export PATH=${PATH}:${home}/deps/0/bin" > "${home}/exports.sh" | ||
echo "alias terraform=tofu" >> "${home}/exports.sh" | ||
echo "alias tf=tofu" >> "${home}/exports.sh" | ||
|
||
AWS_ACCESS_KEY_ID=$(echo "${VCAP_SERVICES}" | jq '.s3[] | select(.name | contains("backup")) | .credentials.access_key_id') | ||
AWS_SECRET_ACCESS_KEY=$(echo "${VCAP_SERVICES}" | jq '.s3[] | select(.name | contains("backup")) | .credentials.secret_access_key') | ||
AWS_DEFAULT_REGION=$(echo "${VCAP_SERVICES}" | jq '.s3[] | select(.name | contains("backup")) | .credentials.region') | ||
AWS_BUCKET=$(echo "${VCAP_SERVICES}" | jq '.s3[] | select(.name | contains("backup")) | .credentials.bucket') | ||
AWS_ENDPOINT=$(echo "${VCAP_SERVICES}" | jq '.s3[] | select(.name | contains("backup")) | .credentials.endpoint') | ||
AWS_FIPS_ENDPOINT=$(echo "${VCAP_SERVICES}" | jq '.s3[] | select(.name | contains("backup")) | .credentials.fips_endpoint') | ||
|
||
if [ -n "${AWS_ACCESS_KEY_ID}" ]; then | ||
{ | ||
echo "export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" | ||
echo "export AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" | ||
echo "export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}" | ||
echo "export AWS_BUCKET=${AWS_BUCKET}" | ||
echo "export AWS_ENDPOINT=${AWS_ENDPOINT}" | ||
echo "export AWS_FIPS_ENDPOINT=${AWS_FIPS_ENDPOINT}" | ||
} >> "${home}/exports.sh" | ||
fi | ||
|
||
MYSQL_CONN_STR=$(echo "${VCAP_SERVICES}" | jq '."aws-rds"[] | select(.plan | contains("mysql")) | .credentials.uri') | ||
MYSQL_DATABASE=$(echo "${VCAP_SERVICES}" | jq '."aws-rds"[] | select(.plan | contains("mysql")) | .credentials.db_name') | ||
MYSQL_HOST=$(echo "${VCAP_SERVICES}" | jq '."aws-rds"[] | select(.plan | contains("mysql")) | .credentials.host') | ||
MYSQL_PASSWORD=$(echo "${VCAP_SERVICES}" | jq '."aws-rds"[] | select(.plan | contains("mysql")) | .credentials.password') | ||
MYSQL_PORT=$(echo "${VCAP_SERVICES}" | jq '."aws-rds"[] | select(.plan | contains("mysql")) | .credentials.port') | ||
MYSQL_USER=$(echo "${VCAP_SERVICES}" | jq '."aws-rds"[] | select(.plan | contains("mysql")) | .credentials.username') | ||
|
||
if [ -n "${MYSQL_CONN_STR}" ]; then | ||
{ | ||
echo "export MYSQL_CONN_STR=${MYSQL_CONN_STR}" | ||
echo "export MYSQL_DATABASE=${MYSQL_DATABASE}" | ||
echo "export MYSQL_HOST=${MYSQL_HOST}" | ||
echo "export MYSQL_PASSWORD=${MYSQL_PASSWORD}" | ||
echo "export MYSQL_PORT=${MYSQL_PORT}" | ||
echo "export MYSQL_USER=${MYSQL_USER}" | ||
} >> "${home}/exports.sh" | ||
fi | ||
|
||
PG_CONN_STR=$(echo "${VCAP_SERVICES}" | jq '."aws-rds"[] | select(.plan | contains("psql")) | .credentials.uri') | ||
PGDATABASE=$(echo "${VCAP_SERVICES}" | jq '."aws-rds"[] | select(.plan | contains("psql")) | .credentials.db_name') | ||
PGHOST=$(echo "${VCAP_SERVICES}" | jq '."aws-rds"[] | select(.plan | contains("psql")) | .credentials.host') | ||
PGPASSWORD=$(echo "${VCAP_SERVICES}" | jq '."aws-rds"[] | select(.plan | contains("psql")) | .credentials.password') | ||
PGPORT=$(echo "${VCAP_SERVICES}" | jq '."aws-rds"[] | select(.plan | contains("psql")) | .credentials.port') | ||
PGUSER=$(echo "${VCAP_SERVICES}" | jq '."aws-rds"[] | select(.plan | contains("psql")) | .credentials.username') | ||
|
||
if [ -n "${PG_CONN_STR}" ]; then | ||
{ | ||
echo "export PG_CONN_STR=${PG_CONN_STR}" | ||
echo "export PGDATABASE=${PGDATABASE}" | ||
echo "export PGHOST=${PGHOST}" | ||
echo "export PGPASSWORD=${PGPASSWORD}" | ||
echo "export PGPORT=${PGPORT}" | ||
echo "export PGUSER=${PGUSER}" | ||
} >> "${home}/exports.sh" | ||
fi | ||
|
||
sed -i '1s/^/source exports.sh\n/' "${home}/.bashrc" | ||
|
||
while : ; do sleep 500 ; done | ||
|
Binary file removed
BIN
-228 KB
terraform/applications/nginx-waf/modules/ngx_http_modsecurity_module.so
Binary file not shown.
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,29 +1,27 @@ | ||
locals { | ||
|
||
## Create a single list of external service names. Multiple applications | ||
## could reference the same service, but the GUID only needs to be looked up once. | ||
services_external = distinct( | ||
flatten( | ||
[ | ||
for key, value in try(var.env.apps, {}) : [ | ||
try(var.env.apps[key].services_external, []) | ||
## Create a single list of external service names. Multiple applications | ||
## could reference the same service, but the GUID only needs to be looked up once. | ||
services_external = toset( | ||
compact( | ||
distinct( | ||
flatten( | ||
[ | ||
for value in try(var.env.apps, {}) : [ | ||
try(value.services_external, []) | ||
] | ||
] | ||
] | ||
) | ||
) | ||
) | ||
} | ||
|
||
output "name" { | ||
value = data.cloudfoundry_service_instance.this | ||
) | ||
} | ||
|
||
## Lookup up service instance GUID's for existing services. | ||
## These can be externally deployed services or services deployed from different code sources. | ||
## The GUID can then be refrenced by data.cloudfoundry_service_instance.this["service-name"].id | ||
data "cloudfoundry_service_instance" "this" { | ||
for_each = { | ||
for key, value in local.services_external : value => value | ||
} | ||
name_or_id = each.value | ||
space = try(var.cloudfoundry.space.id, null) | ||
for_each = try(local.services_external, []) | ||
name_or_id = each.value | ||
space = try(var.cloudfoundry.space.id, null) | ||
} |
Oops, something went wrong.