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

Module 2 Terraform: "local-exec provisioner error" #77

Open
rbncyber27 opened this issue Dec 30, 2024 · 1 comment
Open

Module 2 Terraform: "local-exec provisioner error" #77

rbncyber27 opened this issue Dec 30, 2024 · 1 comment

Comments

@rbncyber27
Copy link

I have encountered an error in line 474 with the null_resource related to not finding the path to the \bin\bash within the environment where the system should be running.

I have tried multiple alternatives but it doesn't seem to work.

The code:
_```
resource "null_resource" "rds_endpoint" {
provisioner "local-exec" {
command = <<EOF
RDS_URL="${aws_db_instance.database-instance.endpoint}"
RDS_URL=$${RDS_URL::-5}
sed -i "s,RDS_ENDPOINT_VALUE,$RDS_URL,g" ${path.module}/resources/ecs/task_definition.json
EOF
interpreter = ["/bin/bash", "-c"]
}

depends_on = [
aws_db_instance.database-instance
]
}


The error:

null_resource.rds_endpoint (local-exec): Executing: ["/bin/bash" "-c" "RDS_URL=\"aws-goat-db.c9as8i4mcjpd.us-east-1.rds.amazonaws.com:3306\"\nRDS_URL=${RDS_URL::-5}\nsed -i \"s,RDS_ENDPOINT_VALUE,$RDS_URL,g\" ./resources/ecs/task_definition.json\n"]
╷
│ Error: local-exec provisioner error
│
│   with null_resource.rds_endpoint,
│   on main.tf line 510, in resource "null_resource" "rds_endpoint":
│  510:   provisioner "local-exec" {
│
│ Error running command 'RDS_URL="aws-goat-db.c9as8i4mcjpd.us-east-1.rds.amazonaws.com:3306"
│ RDS_URL=${RDS_URL::-5}
│ sed -i "s,RDS_ENDPOINT_VALUE,$RDS_URL,g" ./resources/ecs/task_definition.json
│ ': exec: "/bin/bash": executable file not found in %PATH%. Output:
@alexlee820
Copy link

I got the same issue ,have you solved it??

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