Skip to content

Commit

Permalink
Merge pull request #14 from GSI-Xapiens-CSIRO/xapiens
Browse files Browse the repository at this point in the history
Xapiens to main
  • Loading branch information
coy102 authored Nov 29, 2024
2 parents 5205051 + 4be45a4 commit a8415ad
Show file tree
Hide file tree
Showing 11 changed files with 434 additions and 26 deletions.
20 changes: 11 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ module "svep" {
}

module "webgui" {
source = "./webgui/terraform-aws"
region = var.region
base_range = 5000
user_pool_id = module.cognito.cognito_user_pool_id
identity_pool_id = module.cognito.cognito_identity_pool_id
user_pool_web_client_id = module.cognito.cognito_client_id
data_portal_bucket = module.sbeacon.data-portal-bucket
api_endpoint_sbeacon = "${module.sbeacon.api_url}${module.sbeacon.api_stage}/"
api_endpoint_svep = module.svep.api_url
source = "./webgui/terraform-aws"
region = var.region
base_range = 5000
user_pool_id = module.cognito.cognito_user_pool_id
identity_pool_id = module.cognito.cognito_identity_pool_id
user_pool_web_client_id = module.cognito.cognito_client_id
data_portal_bucket = module.sbeacon.data-portal-bucket
api_endpoint_sbeacon = "${module.sbeacon.api_url}${module.sbeacon.api_stage}/"
api_endpoint_svep = module.svep.api_url
pricing_access_key_id = module.pricing_access_key_id
pricing_access_secret_key_id = module.pricing_access_secret_key_id

common-tags = merge(var.common-tags, {
"NAME" = "portal-frontend"
Expand Down
14 changes: 14 additions & 0 deletions webgui/terraform-aws/build_and_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
ENVIRONMENT = """export const environment = {{
production: {production},
config_max_variant_search_base_range: {base_range},
pricingCredentials: {{
accessKeyId: {pricing_access_key_id},
secretAccessKey: {pricing_access_secret_key_id},
}},
auth: {{
region: '{region}',
userPoolId: '{user_pool_id}',
Expand Down Expand Up @@ -85,6 +89,8 @@ def setup_env(
api_endpoint_sbeacon: str,
api_endpoint_svep: str,
dir: str,
pricing_access_key_id: str,
pricing_access_secret_key_id: str,
):
with open(
os.path.join(dir, "src/environments/environment.development.ts"), "w"
Expand All @@ -100,6 +106,8 @@ def setup_env(
user_pool_web_client_id=user_pool_web_client_id,
api_endpoint_sbeacon=api_endpoint_sbeacon,
api_endpoint_svep=api_endpoint_svep,
pricing_access_key_id=pricing_access_key_id,
pricing_access_secret_key_id=pricing_access_secret_key_id,
)
)
with open(os.path.join(dir, "src/environments/environment.ts"), "w") as f:
Expand All @@ -114,6 +122,8 @@ def setup_env(
user_pool_web_client_id=user_pool_web_client_id,
api_endpoint_sbeacon=api_endpoint_sbeacon,
api_endpoint_svep=api_endpoint_svep,
pricing_access_key_id=pricing_access_key_id,
pricing_access_secret_key_id=pricing_access_secret_key_id,
)
)

Expand All @@ -132,6 +142,8 @@ def setup_env(
api_endpoint_sbeacon = args["api_endpoint_sbeacon"]
api_endpoint_svep = args["api_endpoint_svep"]
data_portal_bucket = args["data_portal_bucket"]
pricing_access_key_id = args["pricing_access_key_id"]
pricing_access_secret_key_id = args["pricing_access_secret_key_id"]

setup_env(
base_range,
Expand All @@ -143,6 +155,8 @@ def setup_env(
api_endpoint_sbeacon,
api_endpoint_svep,
webapp_dir,
pricing_access_key_id,
pricing_access_secret_key_id,
)
npm_install(install_cmd, webapp_dir)
build(build_cmd, webapp_dir)
Expand Down
27 changes: 15 additions & 12 deletions webgui/terraform-aws/upload.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
data "external" "build" {
program = ["python", "build_and_hash.py"]
query = {
install_command = var.install-command
build_command = var.build-command
webapp_dir = var.webapp-dir
build_destiation = var.build-destination
base_range = var.base_range
region = var.region
user_pool_id = var.user_pool_id
identity_pool_id = var.identity_pool_id
user_pool_web_client_id = var.user_pool_web_client_id
data_portal_bucket = var.data_portal_bucket
api_endpoint_sbeacon = var.api_endpoint_sbeacon
api_endpoint_svep = var.api_endpoint_svep
install_command = var.install-command
build_command = var.build-command
webapp_dir = var.webapp-dir
build_destiation = var.build-destination
base_range = var.base_range
region = var.region
user_pool_id = var.user_pool_id
identity_pool_id = var.identity_pool_id
user_pool_web_client_id = var.user_pool_web_client_id
data_portal_bucket = var.data_portal_bucket
api_endpoint_sbeacon = var.api_endpoint_sbeacon
api_endpoint_svep = var.api_endpoint_svep
pricing_access_key_id = var.pricing_access_key_id
pricing_access_secret_key_id = var.pricing_access_secret_key_id

}
working_dir = path.module
}
Expand Down
10 changes: 10 additions & 0 deletions webgui/terraform-aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,14 @@ variable "api_endpoint_sbeacon" {
variable "api_endpoint_svep" {
type = string
description = "API endpoint for svep."
}

variable "pricing_access_key_id" {
type = string
description = "Access key for AWS sdk Pricing plan."
}

variable "pricing_access_secret_key_id" {
type = string
description = "Secret key for AWS sdk Pricing plan."
}
1 change: 1 addition & 0 deletions webgui/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@angular/router": "^17.3.11",
"angular-plotly.js": "^5.2.2",
"aws-amplify": "^5.3.25",
"aws-sdk": "^2.1692.0",
"csv-parse": "^5.5.6",
"echarts": "^5.5.1",
"lodash": "^4.17.21",
Expand Down
Loading

0 comments on commit a8415ad

Please sign in to comment.