terraform-coop / terraform-provider-foreman

Terraform provider for Foreman
https://registry.terraform.io/providers/terraform-coop/foreman
Mozilla Public License 2.0
34 stars 32 forks source link

Location and Organization ID #8

Closed lhw closed 3 years ago

lhw commented 3 years ago

Add support for Location and Organization IDs on all API calls (Closes: #3, Closes: #7)

This adds two optional arguments to the provider. organization_id and location_id. Both were optional until Foreman 1.21 but are since required. This change should not break any backwards compatibility but allow the provider to work with all Foreman versions 1.21 and newer as well. The extra arguments will default to the Default Organization and Default Location if not otherwise set. This should be the default behavior of Foreman prior to 1.21 as well.

I am still going to test this in our environment so I am keeping this as Draft until then.

lhw commented 3 years ago

@galindro Do you wanna give this a try? It should also be backwards compatible. The config block should look like this for the provider:

provider "foreman" {
  // [...]
  organization_id = 1
  location_id     = 1
}

Here is a quick build from this branch. But you can also do the go get terraform-provider-foreman_v0.3.0.zip

galindro commented 3 years ago

Hi @lhw . I didn't had enough time yet to test it and I wouldn't expect to have for the next 2 weeks. I'll keep you posted as soon as I have a spot on my tasks to do it.

galindro commented 3 years ago

@lhw , please refer to https://github.com/HanseMerkur/terraform-provider-foreman/issues/16

galindro commented 3 years ago

@lhw this feature worked pretty well.