-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new resources for dev.snaps.consensys.net (#20)
- Loading branch information
1 parent
e71a87c
commit 7736e85
Showing
9 changed files
with
219 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function handler(event) { | ||
var request = event.request; | ||
if (request.uri == "/starknet" || request.uri == "/starknet/") { request.uri = request.uri.replace(/.*starknet.*/,'/starknet/index.html'); } | ||
return request; | ||
} |
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,14 @@ | ||
'use strict'; | ||
exports.handler = (event, context, callback) => { | ||
const response = event.Records[0].cf.response; | ||
const headers = response.headers; | ||
|
||
|
||
headers['x-frame-options'] = [{ | ||
key: 'X-Frame-Options', | ||
value: "SAMEORIGIN" | ||
}]; | ||
|
||
|
||
callback(null, response); | ||
}; |
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,39 @@ | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a | | ||
|
||
## Modules | ||
|
||
| Name | | ||
|------| | ||
| [module.lambda](https://registry.terraform.io/modules/transcend-io/lambda-at-edge/aws/latest) | module | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [aws_s3_bucket.bucket](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/aws_s3_bucket) | resource | | ||
| [aws_s3_bucket_acl.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/aws_s3_bucket_acl) | resource | | ||
| [aws_s3_bucket_versioning.main_versioning](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/aws_s3_bucket_versioning) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="bucket_name"></a> [bucket\_name](#input\_bucket\_name) | Bucket name | `string` | n/a | yes | | ||
| <a name="lambda_name"></a> [lambda\_name](#input\_lambda\_name) | Lambda name | `string` | n/a | yes | | ||
| <a name="lambda_description"></a> [lambda\_description](#input\lambda\description) | Lambda description | `string` | n/a | yes | | ||
| <a name="lambda_code_source_dir"></a> [lambda\_code\_source\_dir](#lambda\_code\_source\_dir) | Lambda code source dir | `string` | n/a | yes | | ||
| <a name="input_tags"></a> [tags](#input\_tags) | Tags | `map(any)` | `{}` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="function_arn"></a> [function\_arn](#function\_arn) | n/a | |
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,28 @@ | ||
resource "aws_s3_bucket" "bucket" { | ||
bucket = var.bucket_name | ||
tags = var.tags | ||
force_destroy = true | ||
} | ||
|
||
resource "aws_s3_bucket_acl" "main" { | ||
bucket = aws_s3_bucket.bucket.id | ||
acl = "private" | ||
} | ||
|
||
resource "aws_s3_bucket_versioning" "main_versioning" { | ||
bucket = aws_s3_bucket.bucket.id | ||
versioning_configuration { | ||
status = "Enabled" | ||
} | ||
} | ||
|
||
module "lambda" { | ||
source = "transcend-io/lambda-at-edge/aws" | ||
version = "0.5.0" | ||
name = var.lambda_name | ||
description = var.lambda_description | ||
runtime = "nodejs16.x" | ||
lambda_code_source_dir = var.lambda_code_source_dir | ||
s3_artifact_bucket = aws_s3_bucket.bucket.bucket | ||
file_globs = ["**"] | ||
} |
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,3 @@ | ||
output "function_arn" { | ||
value = module.lambda.function_arn | ||
} |
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,25 @@ | ||
variable "bucket_name" { | ||
description = "Bucket name" | ||
type = string | ||
} | ||
|
||
variable "lambda_name" { | ||
description = "Lambda name" | ||
type = string | ||
} | ||
|
||
variable "lambda_description" { | ||
description = "Lambda name" | ||
type = string | ||
} | ||
|
||
variable "lambda_code_source_dir" { | ||
description = "Lambda location folder path" | ||
type = string | ||
} | ||
|
||
variable "tags" { | ||
description = "Tags." | ||
type = map(any) | ||
default = {} | ||
} |