We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
file
Terraform v0.14.4 + provider hashicorp.com/dev/nomad v0.14.2
Name Address Port Status Leader Protocol Build Datacenter Region laoqui-hc-mbp-6.local.global 127.0.0.1 4648 alive true 2 1.0.1 dc1 global
provider "nomad" { address = "http://localhost:4646" }
No
nomad_job
main.tf
provider "nomad" { address = "http://localhost:4646" } resource "nomad_job" "nginx" { jobspec = file("${path.root}/nginx.nomad") hcl2 = true }
nginx.nomad
job "nginx" { datacenters = ["dc1"] group "nginx" { network { port "http" { to = 8080 static = 8080 } } task "nginx" { driver = "docker" config { image = "nginx:1.19" ports = ["http"] volumes = [ "local/nginx/hello.conf:/etc/nginx/conf.d/hello.conf", "local/www:/www/data" ] } template { data = <<EOF server { root /www/data; listen {{ env "NOMAD_PORT_http" }}; } EOF destination = "local/nginx/hello.conf" } template { data = file("./index.html") destination = "local/www/index.html" } } } }
index.html
<html> <head> <title>Hello, World!</title> </head> <body> <p>Hello, World!</p> </body> </html>
The nginx job is created with the index page content read from index.html.
nginx
$ terraform plan nomad_job.nginx: Refreshing state... [id=nginx] Error: error parsing jobspec: job "nginx" { datacenters = ["dc1"] group "nginx" { network { port "http" { to = 8080 static = 8080 } } task "nginx" { driver = "docker" config { image = "nginx:1.19" ports = ["http"] volumes = [ "local/nginx/hello.conf:/etc/nginx/conf.d/hello.conf", "local/www:/www/data" ] } template { data = <<EOF server { root /www/data; listen {{ env "NOMAD_PORT_http" }}; } EOF destination = "local/nginx/hello.conf" } template { data = file("./index.html") destination = "local/www/index.html" } } } } :35,23-28: Error in function call; Call to function "file" failed: filesystem function disabled. job "nginx" { datacenters = ["dc1"] group "nginx" { network { port "http" { to = 8080 static = 8080 } } task "nginx" { driver = "docker" config { image = "nginx:1.19" ports = ["http"] volumes = [ "local/nginx/hello.conf:/etc/nginx/conf.d/hello.conf", "local/www:/www/data" ] } template { data = <<EOF server { root /www/data; listen {{ env "NOMAD_PORT_http" }}; } EOF destination = "local/nginx/hello.conf" } template { data = file("./index.html") destination = "local/www/index.html" } } } } :35,23-28: Unsuitable value type; Unsuitable value: value must be known on main.tf line 14, in resource "nomad_job" "nginx": 14: resource "nomad_job" "nginx" {
terraform plan
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Terraform Version
Nomad Version
Provider Configuration
Environment Variables
No
Affected Resource(s)
nomad_job
Terraform Configuration Files
main.tf
nginx.nomad
index.html
Expected Behavior
The
nginx
job is created with the index page content read fromindex.html
.Actual Behavior
Steps to Reproduce
terraform plan
References
The text was updated successfully, but these errors were encountered: