Some confusion on terraform namings

Hi Everyone
As I’m working on terraform labs I have noticed that


what is the name of the file created in local part where filename argument has /root/pet-name
where as after the resource-provider block we have given “my-pet” what is the purpose of it as in lectures its stated as resource name
its kind of bit confusing
suppose it is from cloud perspective i can easily understand that resource will be given the resource name
where as in local im getting confused with the term “resource-name” —>“my-pet” and “argument” -----> “filename = “/root/pet-name””
someone explain this difference thanks in advance

Hi @hari26subramaniam

The my-pet in `local_file resource is known as the resource name. It serves as a unique identifier for this specific resource within the Terraform configuration. This resource name allows one to reference it in other configs in the Terraform code. For example, when you want to output its content or use its filename in other resources.

So, the resource my-pet will create a new file named /root/pet-name.

Hope this helps.

1 Like