Skip to content

Commit

Permalink
Merge pull request #44 from anyscale/brent/update-cors
Browse files Browse the repository at this point in the history
upd: update cors rules in aws-anyscale-s3 module
  • Loading branch information
brent-anyscale authored Feb 6, 2024
2 parents 2beb0f1 + b3db627 commit f89992a
Show file tree
Hide file tree
Showing 12 changed files with 223 additions and 1,206 deletions.
4 changes: 2 additions & 2 deletions modules/aws-anyscale-s3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This module creates the default S3 resources needed for Anyscale to work in a cu

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.15.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.34.0 |

## Modules

Expand All @@ -42,7 +42,7 @@ No modules.
| <a name="input_anyscale_bucket_name"></a> [anyscale\_bucket\_name](#input\_anyscale\_bucket\_name) | (Optional - forces new resource) The name of the bucket. Conflicts with anyscale\_bucket\_prefix. Default is `null`. | `string` | `null` | no |
| <a name="input_anyscale_bucket_prefix"></a> [anyscale\_bucket\_prefix](#input\_anyscale\_bucket\_prefix) | (Optional - forces new resource) Creates a unique bucket name beginning with the specified prefix. Conflicts with anyscale\_bucket\_name. Default is `anyscale-`. | `string` | `"anyscale-"` | no |
| <a name="input_anyscale_cloud_id"></a> [anyscale\_cloud\_id](#input\_anyscale\_cloud\_id) | (Optional) Anyscale Cloud ID. Default is `null`. | `string` | `null` | no |
| <a name="input_cors_rule"></a> [cors\_rule](#input\_cors\_rule) | (Optional)<br>Object containing a rule of Cross-Origin Resource Sharing.<br>The default allows GET access for the purpose of viewing logs<br>from Anyscale Clusters from the Anyscale Web UI (console.anyscale.com). | `any` | <pre>{<br> "allowed_headers": [<br> "*"<br> ],<br> "allowed_methods": [<br> "GET"<br> ],<br> "allowed_origins": [<br> "https://console.anyscale.com"<br> ],<br> "expose_headers": []<br>}</pre> | no |
| <a name="input_cors_rule"></a> [cors\_rule](#input\_cors\_rule) | (Optional)<br>Object containing a rule of Cross-Origin Resource Sharing.<br>The default allows GET, POST, PUT, HEAD, and DELETE<br>access for the purpose of viewing logs and other functionality<br>from within the Anyscale Web UI (*.anyscale.com).<br><br>ex:<pre>cors_rule = {<br> allowed_headers = ["*"]<br> allowed_methods = [GET", "POST", "PUT", "HEAD", "DELETE"]<br> allowed_origins = ["https://*.anyscale.com"]<br>}</pre> | `any` | <pre>{<br> "allowed_headers": [<br> "*"<br> ],<br> "allowed_methods": [<br> "GET",<br> "POST",<br> "PUT",<br> "HEAD",<br> "DELETE"<br> ],<br> "allowed_origins": [<br> "https://*.anyscale.com"<br> ],<br> "expose_headers": []<br>}</pre> | no |
| <a name="input_force_destroy"></a> [force\_destroy](#input\_force\_destroy) | (Optional) Set to true to delete all objects from the bucket so that the bucket can be destroyed without error.<br>These objects are not recoverable.<br>Default is `false`. With this default, you need to empty the bucket if there are objects before `terraform destroy` can be completed. | `bool` | `false` | no |
| <a name="input_lifecycle_rule"></a> [lifecycle\_rule](#input\_lifecycle\_rule) | (Optional) List of maps containing configuration of object lifecycle management. Default is an empty list. | `any` | `[]` | no |
| <a name="input_logging"></a> [logging](#input\_logging) | (Optional) Map containing access bucket logging configuration. Default is an empty map. | `map(string)` | `{}` | no |
Expand Down
3 changes: 2 additions & 1 deletion modules/aws-anyscale-s3/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ locals {
anyscale_bucket_prefix = local.anyscale_bucketname != null ? null : var.anyscale_bucket_prefix

module_tags = tomap({
tf_sub_module = "aws-anyscale-s3"
tf_sub_module = "aws-anyscale-s3",
anyscale_cloud_id = try(var.anyscale_cloud_id, "")
})
}

Expand Down
26 changes: 2 additions & 24 deletions modules/aws-anyscale-s3/test/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
# aws-anyscale-s3 module unit tests
Requirements:
* Go language (this can be installed locally via `brew install go`)
* terratest which is installed with `go mod tidy` (see below)
* A unit test file whose suffix is: _test.go

More info can be found [here](https://terratest.gruntwork.io/docs/getting-started/quick-start/)
You can run the `anyscale-test` terraform and validate outputs.

#### Manual execution
Manully running the go tests can save time during initial development. Requires active aws credentials.
```
cd test
go mod init "<module_name>"
go mod tidy
go test -v
```
Where `<module_name>` is the name of the terraform module (can also be `github.com/<your_repo_name>`).

#### Other useful go commands
`go get -t -u` This updates test modules to the latest versions. Must be followed with `go mod tidy`

#### Retrieving AWS credentials
AWS Credentials can be retreived using the aws cli. It then needs to be exported to the env variable AWS_PROFILE
```
aws sso login --profile <profile_name>
export AWS_PROFILE="<profile_name>"
```
Go Unit tests were removed as they were unused and not maintained.
68 changes: 0 additions & 68 deletions modules/aws-anyscale-s3/test/go.mod

This file was deleted.

Loading

0 comments on commit f89992a

Please sign in to comment.