Lab : Terrafrom Providers Q9 Fails

hi Team ,

In Lab : Terrafrom Providers Q9 the checks are failing .
Below is the question , my working output and checks .
Can you please review and comment why are the checks failing ?
What changes are required for the checks to pass ?

================================================================

Q 9

Create a new configuration file within the same directory called xbox.tf . This file should make use of the same local_file resource type with the below requirements:

Resource Name: xbox
filename: /root/xbox.txt
content: Wouldn't mind an XBox either!

Once the configuration file has been created, use the terraform workflow to create this resource.

================================================================

Output


iac-server $ terraform init

Initializing the backend...

Initializing provider plugins...
- Using previously-installed hashicorp/local v2.1.0

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, we recommend adding version constraints in a required_providers block
in your configuration, with the constraint strings suggested below.

* hashicorp/local: version = "~> 2.1.0"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
iac-server $ 
iac-server $ 
iac-server $ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

local_file.more-things-to-do: Refreshing state... [id=85e6ec1cf7be591e68345cbaf27a4529a4f25eb0]
local_file.things-to-do: Refreshing state... [id=57de5ed15ca8120dba3bd950bad6d5e55b97f635]
local_file.xbox: Refreshing state... [id=789dec7aca2183bed759aac5cb38738e91580ff8]

------------------------------------------------------------------------

No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed.
iac-server $ 
iac-server $ 
iac-server $ terraform apply
local_file.more-things-to-do: Refreshing state... [id=85e6ec1cf7be591e68345cbaf27a4529a4f25eb0]
local_file.xbox: Refreshing state... [id=789dec7aca2183bed759aac5cb38738e91580ff8]
local_file.things-to-do: Refreshing state... [id=57de5ed15ca8120dba3bd950bad6d5e55b97f635]

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
iac-server $ 
iac-server $ pwd
/root/terraform-projects/things-to-do
iac-server $ 
iac-server $ ls -al
total 28
drwxr-xr-x 3 root root 4096 Feb 24 15:33 .
drwxr-xr-x 7 root root 4096 Feb 24 15:19 ..
drwxr-xr-x 3 root root 4096 Feb 24 15:21 .terraform
-rw-r--r-- 1 root root  313 Feb 24 15:19 main.tf
-rw-r--r-- 1 root root 2219 Feb 24 15:33 terraform.tfstate
-rw-r--r-- 1 root root 1562 Feb 24 15:28 terraform.tfstate.backup
-rw-r--r-- 1 root root  108 Feb 24 15:31 xbox.tf
iac-server $ 
iac-server $ cat xbox.tf 
resource "local_file" "xbox" {
  filename = "/root/xbox.txt"
  content  = "Wouldn't mind an XBox either!"
}
iac-server $ 
iac-server $ 

========================================================================

Checks

  • Tasks not completed!

  • resource created as specified?

Command ‘docker exec -w /questions test_infra pytest test_ob2ul4h9.py’ returned non-zero exit status 1.

Terraform Plan shows changes to be applied! Make sure the configuration is up-to-date and applied! filename used by the resource is incorrect content used by the resource is incorrect

Hello, @ppnehe
I noticed that you created xbox TF file in the wrong directory, correct one is christmas-wishlist directory. This question is connected with the question 8.
There is no issue with your TF file except location.

Regards,

Hello @player001

Yes , You are correct . I attempted this lab again and this time in correct location as rightly spotted by you.
This time all checks are passing.

Thank you for quick reply and support as usual.

with best regards
Pradeep Nehe