Task Validation | Terraform Level 3 | 8 Hosting a Static Website on Amazon S3

I keep having a feedback about a missing variable even after creating it in the module and in the root module

Hi @moustafaroushdy1

I’ve just checked it and it’s worked properly from my end, please try again and refer to my variables.tf file.

Thank you so much, I’ve passed the Task by just adding double quotes around the variable name ( I’ve also added the type I’m not sure if that helped)

it’s just confusing because all previous tasks, I write the variables names without the double quotes and this was working
I suggest to do the same in this task just for consistency

Hi @moustafaroushdy1

Thank you very much for your feedback. The correct syntax for a Terraform variable is to use double quotes. Could you please share the task name which still passes without double quotes around the variable name? Then I will check it further.

All other tasks except this one

Hello, anyone struggling with the task? I always receive “Terraform output missing expected ‘S3 bucket’ name or ‘website URL’.” And honestly i am out of ideas.

Here are snippets from the latest try:

Not stated in the task, however here are the outputs (defined in the root module)

bob@iac-server ~/terraform via 💠 default ✖ terraform output
site_bucket_name = "S3 bucket : nautilus-web-30019"
site_website_url = "website URL : http://aws:4566/nautilus-web-30019/index.html"

Check for the website access and the content of the root module

bob@iac-server ~/terraform via 💠 default ➜  curl http://aws:4566/nautilus-web-30019/index.html
Welcome to KKE labs!


bob@iac-server ~/terraform via 💠 default ➜  cat main.tf 
module "s3-static-site" {
 source = "./modules/s3-static-site"
 bucket_name = "nautilus-web-30019"
 index_document = "index.html"
 index_content = "/home/bob/terraform/index.html"
}

bob@iac-server ~/terraform via 💠 default ➜  cat outputs.tf 
output "site_bucket_name" { 
 value = module.s3-static-site.bucket_name
}

output "site_website_url" {
 value = module.s3-static-site.website_url
}

The task requests:

Within the module use outputs.tf file to output the following:
website_url: S3 static website url

And based on my attempts ( and googling ) i over delivered:)
Here are the outputs in the s3-static-site module.

bob@iac-server terraform/modules/s3-static-site via 💠 default ➜  cat outputs.tf 
output "website_url" {
 value = "website URL : http://aws:4566/${aws_s3_bucket.kke.bucket}/index.html"
}

output "bucket_name" {
 value = "S3 bucket : ${aws_s3_bucket.kke.bucket}"
}

Will appreciate any ideas.

Hi @peshovec

Please refer to the screenshot below for the correct output. You do not need to include the website URL. Use the Terraform resource aws_s3_bucket with the attribute bucket_domain_name.

image

Thank you.
My first attempt output just the website_endpoint, Second i modified it according the mentioned in the task local endpoint. All of them however where in the full uri form (https://…, respectively http://… )

Was able to pass the task an hour ago - just modified my (then) latest try by adding descriptions in the outputs. (Also leaved a feedback describing my struggles with the descriptions:) )