-
Notifications
You must be signed in to change notification settings - Fork 457
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use provider within the registry of Terraform hashicorp. #747
Comments
@paultyng hi thx for feedback. We will come to you on this soon |
Hi! terraform 0.13 was just released publicly, and I'm hitting this. I'm trying to add a source entry to use the local binary but I can't work out the syntax. Do you anticipate this being published soon? |
@limburgher hi ! yes I plan to update the provider to TF.0 13 soonish. We plan to release a first a fixes releases then the next one will be the TF 0.13.. stay tuned 馃尰 |
馃憤 Let me know if there is anything I can do to help. This should be self-serve now in the registry UI, you just need to create releases that conform to the publishing criteria (we have a goreleaser config file that can do it). |
@MalloZup also blocked by this, don't find a way to add locally built provider |
Hi all! It looks like this provider will not be straightforward to publish via the registry, because unlike most providers it has a separate build for each Linux distribution, presumably because it's dynamically linking against other libraries that have different ABIs in different distributions. Terraform Registry supports only one package per OS+arch, and so all of the release packages would come under the same To take pressure off the provider maintainers a bit and hopefully get you all moving again, I wanted to let you all know how you can update your locally-installed copies of this provider to work with Terraform v0.13 so that you don't need to be blocked until the provider is published in the public registry. From Terraform's perspective, a provider that isn't listed in a registry comes under the same guidance as for so-called "In-house Providers". The upgrade guide includes some general guidance for these, but since here we're talking specifically about the libvirt provider I can fill in the gaps for you all a bit more by giving some specific examples. First, I'm going to make the assumption that this provider will eventually be published in the Terraform Registry as Next we'll need to identify a directory to install the plugin into. The installer is configurable for different directories, but for simplicity here I'll use the primary recommended location. This provider only has releases for Linux, and on Linux Terraform v0.13 searches for plugins in
Now you can download an appropriate package for provider version v0.6.2, or choose a different version and adjust the version references that follow. Extract your package into the following directory:
In that directory you'll have just the executable file from the archive you downloaded, which should be called (If you are using an With the local plugin package in place, the final step is to add a provider requirement to each of the modules in your configuration to state which provider you mean when you say "libvirt" elsewhere in the module: terraform {
required_providers {
libvirt = {
source = "dmacvicar/libvirt"
version = "0.6.2"
}
}
} With all of that in place, If you already have a I hope that helps! |
@apparentlymart thx for the infos 馃憤 |
ALLL: so there is here the documentation for migrating to TF13. Examples are updated https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/docs/migration-13.md |
Thank you! I may be doing it wrong, as I'm still having issues. I created ~/.local/share/terraform/plugins/registry.terraform.io/dmacvicar/libvirt/0.6.2/linux_amd64, and put 0.6.2 of terraform-provider-libvirt there. Then I added the above block to my providers.tf. terraform init then ends with:
Error: Failed to query available provider packages Could not retrieve the list of available versions for provider -/libvirt: But it did symlink .terraform/plugins/registry.terraform.io/dmacvicar/libvirt/0.6.2/linux_amd64/ in my workspace to the above directory. |
@limburgher if this is existing code/state, you may need to rename existing provider using |
Ah, thank you! Now init finishes, and I can refresh, etc. |
Hi Team, i our environment we are using centos 7 os , i tried the steps what you have told here. but i am still facing the issue while execute terraform init. Initializing the backend... Initializing provider plugins...
Error: Failed to query available provider packages Could not retrieve the list of available versions for provider Below steps i done. same issue please help me to solve this i want to do some automation using terraform in my enviroment |
Validating provider dmacvicar/libvirt v0.6.2 failed: read |
Its not ideal, but if you did want to publish this in the Registry still, you could fork to repos like |
Thank you i solved the issue, could you please share any docs for provisioning the vm's using terraform in libvirt |
Ran into this myself and a reminder for all to follow the above and if you are on MacOS the locations are at: ~/.terraform.d/plugins/registry.terraform.io/ Specifically you also need to change the architecture folder and place the binary there: ~/.terraform.d/plugins/registry.terraform.io/dmacvicar/libvirt/0.6.2/darwin_amd64/ |
@dude051 and others feel free to improve the documentation here: I was thinking it was obvious that one need to change the arch accordingly but maybe is not that clear enough, we could state to change it. Remember that this doc is just a work-around, until we will pubish the RPM/DEB etc packages which will do this for the Linux distros. (see later) @Balajigit2019 happy worked for you? what was the issue? for docs checkout: https://github.com/dmacvicar/terraform-provider-libvirt/tree/master/examples/v0.13 Also as Info: we plan to ship the packages I think personally as @apparentlymart stated, the Allthough withe the new packages we will publish, the user experience is just to put required_providers {
libvirt = {
source = "dmacvicar/libvirt"
version = "0.6.2"
}
}
}```
on their hcl files.
|
I just changed the issue name, because the provider itself can be already used withing terraform V13. Allthough the issue is a research one , how the provider can be published there, so I will let this open. |
I end up with the below error .I guess i am doing some mistake . Can someone please check and let me know what is the exact issue here . No state file was found! State management commands require a state file. Run this command |
@shubgwa your error does not seem related to this issue. If this was a working Terraform deployment before and you are receiving this error, something is not correct with your configuration or your state file is no longer present. This would need to be sorted out and should be separate from this provider in regards to the issues that error would cause. Verify that you have a If you really believe this is due to the libvirt provider, I would open a new issue and provide the exact Terraform command(s) you are running. |
Thank you Justin sir for your prompt response . I followed the procedure given by Fabian Lee ( https://fabianlee.org/2020/02/22/kvm-terraform-and-cloud-init-to-create-local-kvm-resources/ ) but get stuck when i performed terraform init . And i was getting below error : Error: Failed to query available provider packages Could not retrieve the list of available versions for provider -/libvirt: I saw the resolution given by Mateusz : terraform state replace-provider -- -/libvirt dmacvicar/libvirt But i am getting state file error . |
I checked using locate command and try to find terraform.tfstate but it does not exist . |
@shubgwa do you have following block configured in the directory where you run Terraform commands? terraform {
required_providers {
libvirt = {
source = "dmacvicar/libvirt"
version = "0.6.2"
}
}
} Without that, Terraform won't be able to pull the provider.
I guess this happens because you start in fresh Terraform environment, meaning there is no resources in state? If that's the case, you can skip |
@shubgwa and did you follow #747 (comment) to download the provider and to put it in the right place? To be honest, I had really weird issues with locating locally built providers myself with Terraform 0.13. I usually put them in $ cat ~/.terraformrc
plugin_cache_dir = "$HOME/.terraform.d/plugin-cache" And it works. |
thx @invidian, @dude051 and others for support to others. To all: I do think here we are pretty much deviating to the main existence of the issue, which is: that is the problem of the issue. If you have other issue with terraformV13 migration, either write on the chat (see readme.md) or open another issue. Otherwise I do think we will deviate to much from the main point. ( @shubgwa if the comment of @invidian doesn't work, create an issue with all the steps in details you did, where is the provider etc, so we can follow-up etc). thx guys! 馃尰 |
Hi again all! I see the earlier comments about the possibility of distributing this provider as Possibly you saw this already and that's where the idea came from, but in case not I just wanted to say that on Linux Terraform implements the XDG base directory specification for locating provider plugins, so although in my earlier comment I showed installation into a user's home directory there are also two default locations that can be more appropriate for a system-wide package:
Other directories may be supported on certain distributions if they customize the XDG base directory environment variables. By making an OS package install to one of these default search locations, If this is the strategy you intend to take then it may be a little weird to use |
Hi all and @apparentlymart, thx for information and collaboration, so let me summarize the status like following: 1) 1) 0.7.0 Version (next)So it is our current priority and for the next milestone release (0.7.0) to accommodate the situation within the terraform registry and bring the We are currently researching how to make this happen together @dmacvicar and we plan it for the 0.7.0. 2) 0.6.3 Version (current)The current strategy for the 0.6.3 is that we use for the packages the suggested system wide paths.
The current 0.6.3 version is already packaged by openSUSE distros with RPM and binary are provided also for Fedora and Ubuntu.
I am for sure missing maybe other distros who have already other pkgs 鉂わ笍 |
I have added this to the 0.7.0 release plan. The main challenge (//cc @paultyng ) is that the registry does not allow for dependencies, external programs and cgo. Our provider is linked with libvirt, and that makes the provider binary be specific to different Linux distributions. I plan to attack this by trying different approaches: 1.- Create a pure-go version of the provider. This has already been started in a local branch, using go-libvirt.
I am still hopeful this path may work, and I have a good strategy how to get there. We also have the testsuite to check everything is working. The library also has some history and looks maintained. 2.- Create a statically linked version of the provider, and distribute that in the registry, while still using packages like we do today. |
I'm able to get terraform init to work following the various comments in this thread. But I can't get a plan or apply to work. I have
Terraform init results in:
But plan fails with:
Output of
|
HI @gibsonje, please have a look on this doc: https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/docs/migration-13.md if you still have issues feel free to ask in the chat: https://gitter.im/terraform-provider-libvirt/Lobby Let's try to keep this issue focused on "moving" the provider to registry. TIA 馃尮 |
Hey @paultyng we got this done! |
Thank you so much!!! |
馃憢 Hi, I'm on the Terraform Providers team at HashiCorp. With the release of the Terraform 0.13 beta, users can now download and install community providers from the registry. We are inviting provider authors (especially those for popular community providers) to publish their providers in a closed beta.
To get invited to the closed beta, please email terraform-registry-beta@hashicorp.com. We need:
You can use one key for all of your providers, or separate keys if you prefer. If you are publishing from an organization, this key or keys will be associated with that namespace. Once in the beta, you can manage personal keys in the UI as well.
The text was updated successfully, but these errors were encountered: