Skip to content

Commit

Permalink
feat: Add support for static web sites hosting.
Browse files Browse the repository at this point in the history
Co-authored-by: Philippe LEAL <[email protected]>
  • Loading branch information
benoit-garcia and lotusnoir committed Apr 1, 2024
1 parent 566edef commit e6b5121
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module "my_bucket" {
| [scaleway_object_bucket_acl.this](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/object_bucket_acl) | resource |
| [scaleway_object_bucket_lock_configuration.this](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/object_bucket_lock_configuration) | resource |
| [scaleway_object_bucket_policy.this](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/object_bucket_policy) | resource |
| [scaleway_object_bucket_website_configuration.this](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/object_bucket_website_configuration) | resource |

## Inputs

Expand All @@ -47,6 +48,7 @@ module "my_bucket" {
| <a name="input_tags"></a> [tags](#input_tags) | A list of tags for the bucket. As the Scaleway console does not support key/value tags, tags are written with the format value/value. | `list(string)` | `[]` | no |
| <a name="input_versioning_enabled"></a> [versioning_enabled](#input_versioning_enabled) | Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state. You can, however, suspend versioning on that bucket. | `bool` | `false` | no |
| <a name="input_versioning_lock_configuration"></a> [versioning_lock_configuration](#input_versioning_lock_configuration) | Specifies the Object Lock rule for the bucket. Requires versioning. | ```object({ mode = string, days = optional(number), years = optional(number), })``` | ```{ "days": null, "mode": "GOVERNANCE", "years": null }``` | no |
| <a name="input_website_index"></a> [website_index](#input_website_index) | Website Configuration. | `string` | `null` | no |

## Outputs

Expand Down
11 changes: 11 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,14 @@ resource "scaleway_object_bucket_policy" "this" {
policy = jsonencode(var.policy)
project_id = var.project_id
}

resource "scaleway_object_bucket_website_configuration" "this" {
count = var.website_index != null ? 1 : 0

bucket = scaleway_object_bucket.this.name
project_id = var.project_id

index_document {
suffix = var.website_index
}
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ variable "versioning_lock_configuration" {
years = null,
}
}

variable "website_index" {
description = "Website Configuration."
type = string
default = null
}

0 comments on commit e6b5121

Please sign in to comment.