-
Notifications
You must be signed in to change notification settings - Fork 101
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
Add importer to resources #137
Comments
Hey @lgfa29, sorry to bump an ancient issue, but do you think this would be possible at some point? I was considering switching some custom scripts and configuration management to use the Nomad provider but being able to import resources would be pretty important in getting started. ACL policies, tokens, and namespaces would probably be at the top of our list for priority. I wish I could attempt this but I don't write Go 😅 |
It's been a while huh 😞 We currently don't have it a date to get this work in, but I also just realized that the list is wrong 😅 I probably just listed all resources we had at the time without checking, but most of them are actually already importable, including the ones you listed. provider "nomad" {
address = "http://localhost:4646"
}
resource "nomad_acl_token" "bootstrap" {
name = "Bootstrap Token"
type = "management"
global = true
}
resource "nomad_acl_policy" "test" {
name = "test"
rules_hcl = file("${path.module}/policy.hcl")
}
resource "nomad_namespace" "dev" {
name = "dev"
} $ terraform import nomad_namespace.dev dev
nomad_namespace.dev: Importing from ID "dev"...
nomad_namespace.dev: Import prepared!
Prepared nomad_namespace for import
nomad_namespace.dev: Refreshing state... [id=dev]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
$ terraform import nomad_acl_policy.test test
nomad_acl_policy.test: Importing from ID "test"...
nomad_acl_policy.test: Import prepared!
Prepared nomad_acl_policy for import
nomad_acl_policy.test: Refreshing state... [id=test]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
$ terraform import nomad_acl_token.bootstrap 695bff24-5be9-1bfb-4a6b-54883ed61cbe
nomad_acl_token.bootstrap: Importing from ID "695bff24-5be9-1bfb-4a6b-54883ed61cbe"...
nomad_acl_token.bootstrap: Import prepared!
Prepared nomad_acl_token for import
nomad_acl_token.bootstrap: Refreshing state... [id=695bff24-5be9-1bfb-4a6b-54883ed61cbe]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
$ terraform state list
nomad_acl_policy.test
nomad_acl_token.bootstrap
nomad_namespace.dev Did you get an error when trying to import any of them? |
Oh that's great to see! No to be honest I didn't even try since it seemed things indicated it wasn't supported and undocumented 😅 Thank you for looking into it! |
can the new nomad_csi_volume be added to the import list please?
|
Ah good point @tristanmorgan. Added in #359 which should close this issue 🙂 |
Terraform allows importing existing resources into a state using the
terraform import
command. In order to support this functionality resources must implement the functionalities described in this guide.It may not be possible to add
Importer
s to all resources, but we should try adding them whenever possible.Here's a list of the current resources, we can check off when an importer is implemented or deemed not possible.
The text was updated successfully, but these errors were encountered: