Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/tmp/.schematics/addhost.sh Doesn't exist on terraform plan #83

Open
Zman94 opened this issue Feb 24, 2021 · 7 comments
Open

/tmp/.schematics/addhost.sh Doesn't exist on terraform plan #83

Zman94 opened this issue Feb 24, 2021 · 7 comments
Assignees

Comments

@Zman94
Copy link

Zman94 commented Feb 24, 2021

Issue

When running terraform init; terraform plan, I get the following error

  on .terraform/modules/apply_aws_sat_location/aws/sat-location/modules/ec2/ec2.tf line 11, in resource "aws_instance" "ec2_instance":
  11:   user_data = file("/tmp/.schematics/addhost.sh")

Invalid value for "path" parameter: no file exists at
/tmp/.schematics/addhost.sh; this function works only with files that are
distributed as part of the configuration source code, so if this file will be
created by a resource in this configuration you must instead obtain this
result from an attribute of that resource.

Debugging

Attempt 1

Terrafom seems to expect the file to exist before a plan and apply. By running

mkdir /tmp/.schematics; touch /tmp.schematics/addhost.sh

I'm able to bypass the error locally; however, we're using this in a terraform as a service cloud and can't rely on local setup commands

Attempt 2

Adding the above local commands to the module location.sh.

Still got the same error because terraform doesn't see the file at initialization. Even with a depends_on = [module.satellite-location], terraform errors.

Solution thoughts

Perhaps Terraform's local_file will be the solution. That would require refactoring the last part of the module, but the file could also be passed as output from the module and imported into ec2 instances.

@anilkumarnagaraj anilkumarnagaraj self-assigned this Feb 25, 2021
@ocofaigh ocofaigh transferred this issue from terraform-ibm-modules/terraform-ibm-satellite Jul 8, 2022
@ocofaigh ocofaigh transferred this issue from terraform-ibm-modules/terraform-ibm-issue-tracker Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants