Terraform level 4, task 4- task validation failed

I’m getting a task validation error on this task. When I hit the Check button, I’m getting only this screenshot without a detailed description -

My folder structure is below

total 36
drwxr-xr-x 1 bob bob 4096 Nov 23 20:59 .
drwxr-x--- 1 bob bob 4096 Nov 23 21:02 ..
-rw-rw-r-- 1 bob bob  435 Jun 19 15:04 README.MD
drwxr-xr-x 4 bob bob 4096 Nov 23 20:59 env
-rw-r--r-- 1 bob bob  532 Nov 23 20:54 main.tf
drwxr-xr-x 5 bob bob 4096 Nov 23 20:55 modules
-rw-rw-r-- 1 bob bob 1116 May 13  2025 provider.tf
-rw-r--r-- 1 bob bob  496 Nov 23 20:54 variables.tf

./env:
total 16
drwxr-xr-x 4 bob bob 4096 Nov 23 20:59 .
drwxr-xr-x 1 bob bob 4096 Nov 23 20:59 ..
drwxr-xr-x 3 bob bob 4096 Nov 23 21:07 dev
drwxr-xr-x 3 bob bob 4096 Nov 23 21:05 prod

./env/dev:
total 32
drwxr-xr-x 3 bob bob 4096 Nov 23 21:07 .
drwxr-xr-x 4 bob bob 4096 Nov 23 20:59 ..
drwxr-xr-x 4 bob bob 4096 Nov 23 21:06 .terraform
-rw-r--r-- 1 bob bob 1377 Nov 23 21:06 .terraform.lock.hcl
-rw-r--r-- 1 bob bob  210 Nov 23 21:00 dev.tfvars
lrwxrwxrwx 1 bob bob   27 Nov 23 21:01 main.tf -> /home/bob/terraform/main.tf
lrwxrwxrwx 1 bob bob   27 Nov 23 21:01 modules -> /home/bob/terraform/modules
-rw-r--r-- 1 bob bob 8916 Nov 23 21:06 terraform.tfstate
lrwxrwxrwx 1 bob bob   32 Nov 23 21:01 variables.tf -> /home/bob/terraform/variables.tf

./env/dev/.terraform:
total 16
drwxr-xr-x 4 bob bob 4096 Nov 23 21:06 .
drwxr-xr-x 3 bob bob 4096 Nov 23 21:07 ..
drwxr-xr-x 2 bob bob 4096 Nov 23 21:06 modules
drwxr-xr-x 3 bob bob 4096 Nov 23 21:06 providers

./env/prod:
total 32
drwxr-xr-x 3 bob bob 4096 Nov 23 21:05 .
drwxr-xr-x 4 bob bob 4096 Nov 23 20:59 ..
drwxr-xr-x 4 bob bob 4096 Nov 23 21:02 .terraform
-rw-r--r-- 1 bob bob 1377 Nov 23 21:02 .terraform.lock.hcl
lrwxrwxrwx 1 bob bob   27 Nov 23 21:02 main.tf -> /home/bob/terraform/main.tf
lrwxrwxrwx 1 bob bob   27 Nov 23 21:02 modules -> /home/bob/terraform/modules
-rw-r--r-- 1 bob bob  215 Nov 23 21:00 prod.tfvars
-rw-r--r-- 1 bob bob 8938 Nov 23 21:04 terraform.tfstate
lrwxrwxrwx 1 bob bob   32 Nov 23 21:02 variables.tf -> /home/bob/terraform/variables.tf

./modules:
total 20
drwxr-xr-x 5 bob bob 4096 Nov 23 20:55 .
drwxr-xr-x 1 bob bob 4096 Nov 23 20:59 ..
drwxr-xr-x 2 bob bob 4096 Nov 23 20:55 dynamodb
drwxr-xr-x 2 bob bob 4096 Nov 23 20:56 elasticsearch
drwxr-xr-x 2 bob bob 4096 Nov 23 20:56 secretsmanager

./modules/dynamodb:
total 20
drwxr-xr-x 2 bob bob 4096 Nov 23 20:55 .
drwxr-xr-x 5 bob bob 4096 Nov 23 20:55 ..
-rw-r--r-- 1 bob bob  254 Nov 23 20:56 main.tf
-rw-r--r-- 1 bob bob   81 Nov 23 20:57 outputs.tf
-rw-r--r-- 1 bob bob  202 Nov 23 20:56 variables.tf

./modules/elasticsearch:
total 20
drwxr-xr-x 2 bob bob 4096 Nov 23 20:56 .
drwxr-xr-x 5 bob bob 4096 Nov 23 20:55 ..
-rw-r--r-- 1 bob bob  262 Nov 23 20:57 main.tf
-rw-r--r-- 1 bob bob   93 Nov 23 20:57 outputs.tf
-rw-r--r-- 1 bob bob  209 Nov 23 20:57 variables.tf

./modules/secretsmanager:
total 20
drwxr-xr-x 2 bob bob 4096 Nov 23 20:56 .
drwxr-xr-x 5 bob bob 4096 Nov 23 20:55 ..
-rw-r--r-- 1 bob bob  284 Nov 23 20:58 main.tf
-rw-r--r-- 1 bob bob   70 Nov 23 20:58 outputs.tf
-rw-r--r-- 1 bob bob  280 Nov 23 20:58 variables.tf

@raymond.baoly Could you please advise what could be wrong?
Also, it’s not clear what should be inside terraform_config.tf

Hi @petya.bogdan

Thanks for your detailed feedback. I wasn’t able to reproduce your issue or complete the task. I’ll check it further and get back to you.

image


image
it doesn’t say that we need to create “env” directory, what’s happening with poor task objective descriptions?


check this now, please…

Hi @Mederbek

There is an internal ticket for this. I’ll work with the team to update it properly and keep you updated.

@raymond.baoly Do you any updates regarding this issue?

Hi @petya.bogdan

There was an update that allows the task to be completed, but in my view it’s not clear enough for users to understand and finish on their own. I’ve shared some suggestions and reminded the team to review and consider them. I’ll keep you updated.

2 Likes

@raymond.baoly do you have any update?

Hi @azer.chelebiyev

There’s a new update regarding the sentence wording, but in my view, it’s still not clear enough. I’m still discussing with the team to get a better requirement.

I’m failing validation as well for this task. I even tried different workspaces, and that didn’t work.

@raymond.baoly do you have any update?

Hello,
I also have the same issue . It just display text without explanation what is wrong.
abd after number of attempts I figured out that there is env folder , that symlinks should be to abolute path, but this error says nothing.

No worries!!
Uh oh! Looks like the task was not completed successfully. But it’s Ok. You can try again next time this task is assigned to you.

You may check your work again to see what went wrong. The environment expires in 5 minutes.

If you think you did your work correctly and is marked failed, you may request for a review from your task dashboard. Or alternatively please submit outputs/screenshot(s) of your work and post to community.kodekloud.com

You can also view your results in your dashboard under the “Active Practice” page.

Hello, stuck with the task too -verification failed multiple times.
So i start “digging”. Will try not to reveal details, so not to compromise the exercise for everyone. So some good willing to understand will be necessary. Sorry about that.

Pretty sure about the environments paths, based on “clinched” validation error explanation:

/home/bob/terraform/env/dev/dev.tfvars not found

Also discovered the hard way, elasticsearch-version must be specified :slight_smile:

Totally can’t figure out the expected meaning of the paragraph about separate terraform_config.tf files.
As i understand, the only difference is the KKE_ENV, which is addressed in corresponding tfvars file. So i just copied provider.tf (can be on me, i am non native in english).

Now i am feeling, that i reach the point, when any advice will be appreciated, as i am very struggling to figure what is wrong now.

and these are from the same session:

bob@iac-server ~/terraform via 💠 default ➜  terraform -chdir=./env/dev output
kke_dynamodb_table_name = "devops-dev-table"
kke_elasticsearch_domain_endpoint = "devops-dev-es.us-east-1.es.localhost.localstack.cloud:4566"
kke_secret_arn = "arn:aws:secretsmanager:us-east-1:000000000000:secret:devops-dev-secret-IsnMAH"

bob@iac-server ~/terraform via 💠 default ➜  terraform -chdir=./env/prod output
kke_dynamodb_table_name = "devops-prod-table"
kke_elasticsearch_domain_endpoint = "devops-prod-es.us-east-1.es.localhost.localstack.cloud:4566"
kke_secret_arn = "arn:aws:secretsmanager:us-east-1:000000000000:secret:devops-prod-secret-YXRhvN"


bob@iac-server ~/terraform via 💠 default ➜  terraform -chdir=./env/dev state list
module.dynamodb.aws_dynamodb_table.kke
module.elasticsearch.aws_elasticsearch_domain.kke
module.secretsmanager.aws_secretsmanager_secret.kke
module.secretsmanager.aws_secretsmanager_secret_version.kke

bob@iac-server ~/terraform via 💠 default ➜  terraform -chdir=./env/prod state list
module.dynamodb.aws_dynamodb_table.kke
module.elasticsearch.aws_elasticsearch_domain.kke
module.secretsmanager.aws_secretsmanager_secret.kke
module.secretsmanager.aws_secretsmanager_secret_version.kke

Another, probably worth mentioning is my understanding for the symlinking, for which the result is like this:

│   │   ├── main.tf -> /home/bob/terraform/main.tf
│   │   ├── modules -> /home/bob/terraform/modules
│   │   ├── outputs.tf -> /home/bob/terraform/outputs.tf
│   │   └── variables.tf -> /home/bob/terraform/variables.tf

Just to update my undergoing findings. TL/DR: not obeying the naming convention is not “catched” with details when verification fails.

  1. Symlinks seems correct as i understood them.

  2. Also was providing also .auto.tfvars and ensuring the secret values are ok still without any success in validation.

  3. Then i got a little bit suspicious - intentionally did not obey the requested name convention for the prefix- e.g. devops prefix was requested and i used completely different.
    Was expecting that validation will fail with statement about the names, which should point that at least the config is evaluated to this point. (similar as the case when symlinks and folders are not intact)
    However the task verification did not specify any reason, just the well known general not ok (same as the screenshot in the previous post)

Hi guys,

I was able to pass this one, but the solution includes a lot of details that weren’t mentioned in the task. I’m still working with the team to improve the task description.

Thanks for the effort and updating us.

P.s. noted .terraform In the screenshot. Probably it is worth to continue my attempts to create the secret value outside the modules… hmmm.

@raymond.baoly do you have any update?

Not yet, the team is still working on it.

This task is now working correctly and has been resolved.

Thank you @raymond.baoly

For anyone else failing the task, try symlinking the modules directory. My apparent mistake was symlinking the individual modules.
After I changed that it was passed with no hiccups.