Skip to content

Instantly share code, notes, and snippets.

@jwieringa
Created September 9, 2015 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwieringa/ef1830a5e9c30e416b64 to your computer and use it in GitHub Desktop.
Save jwieringa/ef1830a5e9c30e416b64 to your computer and use it in GitHub Desktop.
provider "aws" {
region = "${var.aws_region}"
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
}
variable "aws_region" {
default = "us-east-1"
}
output "website_endpoint" {
value = "${aws_s3_bucket.www.website_endpoint}"
}
resource "aws_s3_bucket" "www" {
bucket = "tf-example"
acl = "public-read"
website {
index_document = "index.html"
error_document = "error.html"
}
}
➜ tf-route-example terraform plan
Refreshing Terraform state prior to plan...
The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed.
Note: You didn't specify an "-out" parameter to save this plan, so when
"apply" is called, Terraform can't guarantee this is what will execute.
+ aws_s3_bucket.www
acl: "" => "public-read"
bucket: "" => "tf-example"
force_destroy: "" => "0"
hosted_zone_id: "" => "<computed>"
region: "" => "<computed>"
website.#: "" => "1"
website.0.error_document: "" => "error.html"
website.0.index_document: "" => "index.html"
website_domain: "" => "<computed>"
website_endpoint: "" => "<computed>"
Plan: 1 to add, 0 to change, 0 to destroy.
➜ tf-route-example terraform apply
aws_s3_bucket.www: Creating...
acl: "" => "public-read"
bucket: "" => "tf-example"
force_destroy: "" => "0"
hosted_zone_id: "" => "<computed>"
region: "" => "<computed>"
website.#: "" => "1"
website.0.error_document: "" => "error.html"
website.0.index_document: "" => "index.html"
website_domain: "" => "<computed>"
website_endpoint: "" => "<computed>"
aws_s3_bucket.www: Creation complete
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.
State path: terraform.tfstate
Outputs:
website_endpoint = tf-example.s3-website-us-east-1.amazonaws.com
➜ tf-route-example terraform output website_endpoint
tf-example.s3-website-us-east-1.amazonaws.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment