Resource
dcloud_bucket_website
Serves a bucket as a static website at website_url (an index document, or a redirect of every request). Objects still need a public-read policy to be served to anyone. Destroying it stops serving; custom domains (dcloud_bucket_domain) are kept.
Example Usage
resource "dcloud_bucket_website" "site" {
bucket = dcloud_bucket.site.id
index_document = "index.html"
error_document = "404.html"
routing_rules = jsonencode([{
condition = { keyPrefixEquals = "docs/" }
redirect = { replaceKeyPrefixWith = "documentation/" }
}])
}Schema
Required
bucket(String) The id of the parent resource ({name}in the path). Changing it replaces the resource.
Optional
error_document(String) Key served with 404 for a missing page, e.g. 404.html. Up to 1024 characters.index_document(String) Index document suffix, e.g. index.html; required unless redirectAllRequestsTo. Up to 255 characters.redirect_all_requests_to(String){ hostName, protocol }: send every request to another host; usejsonencode. Excludes the other arguments.routing_rules(String) AWS RoutingRules,[{ condition = {...}, redirect = {...} }]; usejsonencode.
Read-Only
id(String) The resource's id.website_url(String) The website's address.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
terraform import dcloud_bucket_website.site <bucket-name>Generated from the provider's schema.
Related