diff --git a/README.md b/README.md index 4ba5a71..7d7d690 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Serverless Beacon [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +![assets/logo-black.png](assets/logo-black.png) + ## Why serverless? Serverless means the service does not require any servers to be provisioned. The idea is to minimise running costs, as well as support arbitrary scalablility. It @@ -21,7 +23,7 @@ cd terraform-aws-serverless-beacon ### Option 1: Setting up the development environment -Skip to next section if you're only interested in deployment or using a different architecture compared to AWS lambda environment. +Skip to next section if you're only interested in deployment or using a different architecture compared to AWS lambda environment. The following setup must be performed on a latest Amazon Linux instance to match the lambda runtimes. If this is not a viable option, please resort to using Docker. Run the following shell commands to setup necessary build tools. Valid for Amazon Linux development instances. @@ -42,11 +44,11 @@ make sudo make install ``` -Make sure you have a terraform version newer than `Terraform v1.1.6` if you're not using the docker image. Run the following command to get the terraform binary. +Make sure you have a terraform version newer than `Terraform v1.3.7` if you're not using the docker image. Run the following command to get the terraform binary. ```bash -wget https://releases.hashicorp.com/terraform/1.2.8/terraform_1.2.8_linux_386.zip -sudo unzip terraform_1.2.8_linux_386.zip -d /usr/bin/ +wget https://releases.hashicorp.com/terraform/1.2.8/terraform_1.3.7_linux_386.zip +sudo unzip terraform_1.3.7_linux_386.zip -d /usr/bin/ ``` ### Option 2: Using the docker image @@ -98,12 +100,6 @@ terraform apply Your beacon deployment could be a part of a larger program with a front-end and other services. In that case, on the parent folder that the repo folder resides, create a `main.tf` file. ```bash # main.tf - -provider "aws" { - # aws region - region = "REGION" -} - module "serverless-beacon" { # repo folder source = "./terraform-aws-serverless-beacon" @@ -119,8 +115,8 @@ module "serverless-beacon" { # aws region region = "REGION" } - ``` +Please refer to [./examples](./examples) to find a minimal and a complete setup. ## Development All the layers needed for the program to run are in layers folder. To add a new layer for immediate use with additional configs, run the following commands. Once the decision to use the library is finalised update the `init.sh` script to automate the process. @@ -149,7 +145,7 @@ cp lib terraform-aws-serverless-beacon/layers// * Collaborative development -Please make a copy of `backend.tf.template` with suited parameters and rename as `backend.tf`. Refer to documentation for more information [https://www.terraform.io/language/settings/backends/configuration](https://www.terraform.io/language/settings/backends/configuration). +Please make a copy of `backend.tf.template` with suited parameters and rename as `backend.tf`. Refer to documentation for more information [https://www.terraform.io/language/settings/backends/configuration](https://www.terraform.io/language/settings/backends/configuration). If this is not done, make sure the terraform lock and state files are stored securely to avoid infrastructure-vs-code inconsistencies. Please refer to [./examples/full](./examples/full) to find a an example backend. ## API diff --git a/assets/logo-black.png b/assets/logo-black.png new file mode 100644 index 0000000..7d1c8da Binary files /dev/null and b/assets/logo-black.png differ diff --git a/assets/logo-tile.png b/assets/logo-tile.png new file mode 100644 index 0000000..761b9b0 Binary files /dev/null and b/assets/logo-tile.png differ diff --git a/backend.tf.template b/backend.tf.template index 69416a1..0f3af5f 100644 --- a/backend.tf.template +++ b/backend.tf.template @@ -1,9 +1,8 @@ terraform { backend "s3" { - bucket = "sbeacon-terraform-states" - key = "sbeacon" - region = "ap-southeast-2" + bucket = "sbeacon-terraform-states" + key = "sbeacon" + region = "ap-southeast-2" dynamodb_table = "terraform-state-locks" } } - diff --git a/examples/full/backend.tf b/examples/full/backend.tf new file mode 100644 index 0000000..0f3af5f --- /dev/null +++ b/examples/full/backend.tf @@ -0,0 +1,8 @@ +terraform { + backend "s3" { + bucket = "sbeacon-terraform-states" + key = "sbeacon" + region = "ap-southeast-2" + dynamodb_table = "terraform-state-locks" + } +} diff --git a/examples/full/main.tf b/examples/full/main.tf index cf01df3..2ee4607 100644 --- a/examples/full/main.tf +++ b/examples/full/main.tf @@ -1,15 +1,35 @@ -provider "aws" { - region = "ap-southeast-2" -} - module "serverless-beacon" { + region = "us-east-1" source = "../.." - beacon-id = "au.csiro-serverless.beacon" - beacon-name = "CSIRO Serverless Beacon" - organisation-id = "CSIRO" - organisation-name = "CSIRO" common-tags = { - stack = "serverless-beacon" + stack = "serverless-beacon" environment = "dev" } + variants-bucket-prefix = "sbeacon-variants-" + metadata-bucket-prefix = "sbeacon-metadata-" + lambda-layers-bucket-prefix = "sbeacon-lambda-layers-" + beacon-id = "au.csiro.sbeacon" + beacon-name = "CSIRO Serverless Beacon" + beacon-api-version = "v2.0.0" + beacon-environment = "dev" + beacon-description = "Serverless Beacon (sBeacon)" + beacon-version = "v0.1.0" + beacon-welcome-url = "https://bioinformatics.csiro.au/" + beacon-alternative-url = "https://bioinformatics.csiro.au/" + beacon-create-datetime = "2018-11-26H00:00:00Z" + beacon-update-datetime = "2023-03-16H00:00:00Z" + beacon-handovers = "[]" + beacon-documentation-url = "https://github.com/EGA-archive/beacon2-ri-api" + beacon-default-granularity = "boolean" + beacon-uri = "https://beacon.csiro.au" + organisation-id = "CSIRO" + organisation-name = "CSIRO" + beacon-org-description = "CSIRO, Australia" + beacon-org-address = "AEHRC, Westmead NSW, Australia" + beacon-org-welcome-url = "https://beacon.csiro.au" + beacon-org-contact-url = "https://bioinformatics.csiro.au/get-in-touch/" + beacon-org-logo-url = "https://raw.githubusercontent.com/aehrc/terraform-aws-serverless-beacon/master/assets/logo-tile.png" + beacon-service-type-group = "au.csiro" + beacon-service-type-artifact = "beacon" + beacon-service-type-version = "1.0" } diff --git a/examples/full/outputs.tf b/examples/full/outputs.tf index 1ec5775..ee1f927 100644 --- a/examples/full/outputs.tf +++ b/examples/full/outputs.tf @@ -1,4 +1,4 @@ output "api_url" { - value = module.serverless-beacon.api_url + value = module.serverless-beacon.api_url description = "URL used to invoke the API." } diff --git a/examples/minimum/main.tf b/examples/minimum/main.tf index 278ee1f..413c8e8 100644 --- a/examples/minimum/main.tf +++ b/examples/minimum/main.tf @@ -1,11 +1,10 @@ -provider "aws" { - region = "ap-southeast-2" -} - module "serverless-beacon" { - source = "../.." - beacon-id = "au.csiro-serverless.beacon" - beacon-name = "CSIRO Serverless Beacon" - organisation-id = "CSIRO" - organisation-name = "CSIRO" + source = "../.." + beacon-id = "au.csiro-serverless.beacon" + variants-bucket-prefix = "sbeacon-" + metadata-bucket-prefix = "sbeacon-metadata-" + lambda-layers-bucket-prefix = "sbeacon-lambda-layers-" + beacon-name = "CSIRO Serverless Beacon" + organisation-id = "CSIRO" + organisation-name = "CSIRO" } diff --git a/examples/minimum/outputs.tf b/examples/minimum/outputs.tf index 1ec5775..ee1f927 100644 --- a/examples/minimum/outputs.tf +++ b/examples/minimum/outputs.tf @@ -1,4 +1,4 @@ output "api_url" { - value = module.serverless-beacon.api_url + value = module.serverless-beacon.api_url description = "URL used to invoke the API." } diff --git a/variables.tf b/variables.tf index d793661..04ac49c 100644 --- a/variables.tf +++ b/variables.tf @@ -143,7 +143,7 @@ variable "beacon-org-address" { variable "beacon-org-welcome-url" { type = string description = "Value for beacon organisation welcome url" - default = "https://beacon.csiro.au" + default = "https://bioinformatics.csiro.au/" } variable "beacon-org-contact-url" { @@ -155,7 +155,7 @@ variable "beacon-org-contact-url" { variable "beacon-org-logo-url" { type = string description = "Value for beacon organisation logo url" - default = "https://bioinformatics.csiro.au/covid-19-sbeacon/" + default = "https://raw.githubusercontent.com/aehrc/terraform-aws-serverless-beacon/master/assets/logo-tile.png" } # Beacon service variables