ionos-cloud / terraform-provider-ionoscloud

The IonosCloud Terraform provider gives the ability to deploy and configure resources using the IonosCloud APIs.
Mozilla Public License 2.0
34 stars 23 forks source link

Add Documentation for Terraform 0.14 #1

Closed gewuerzgurke84 closed 3 years ago

gewuerzgurke84 commented 3 years ago

Description

The provided documentation shows the usage with Terraform Versions older than 0.14

Expected behavior

Add Documentation how to start things with 0.14

Environment

Terraform version:

0.14

Provider version:

OS: Debian on Win10/WSL1

Configuration Files

terraform {
  required_providers {
    ionoscloud = {
      source = "ionos-cloud/ionoscloud"
      version = "~> 5.0.0"
    }
  }
}

provider "ionoscloud" {
  username = "$removed"
  password = "$removed"
}

How to Reproduce

Example Config results in an error like thios

terraform init

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/ionoscloud versions matching "~> 5.0.0"...

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider
hashicorp/ionoscloud: provider registry registry.terraform.io does not have a
provider named registry.terraform.io/hashicorp/ionoscloud

If you have just upgraded directly from Terraform v0.12 to Terraform v0.14
then please upgrade to Terraform v0.13 first and follow the upgrade guide for
that release, which might help you address this problem.

Error and Debug Output

Additional Notes

References

mflorin commented 3 years ago

Hello @gewuerzgurke84,

I've tested on debian on win10/wsl2, native linux (ubuntu 20.04) and osx 11.1, with terraform 0.14.4 and 0.14.5 using the same config and it worked fine. Below you can find the output I got. The main difference is that it looks up the module as ionos-cloud/ionoscloud and not hashicorp/ionoscloud. Perhaps there's some extra configuration or environment vars that are affecting your result?

terraform init

Initializing the backend...

Initializing provider plugins...
- Finding ionos-cloud/ionoscloud versions matching "~> 5.0.0"...
- Installing ionos-cloud/ionoscloud v5.0.4...
- Installed ionos-cloud/ionoscloud v5.0.4 (signed by a HashiCorp partner, key ID 2D2E9201D5B7747D)

Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/plugins/signing.html

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
gewuerzgurke84 commented 3 years ago

Hi @mflorin ,

I think you misunderstood:

_$ terraform init Initializing the backend... Initializing provider plugins... - Finding hashicorp/ionoscloud versions matching "~> 5.0.0"... Warning: Version constraints inside provider configuration blocks are deprecated on example.tf line 2, in provider "ionoscloud": 2: version = "~> 5.0.0" Terraform 0.13 and earlier allowed provider version constraints inside the provider configuration block, but that is now deprecated and will be removed in a future version of Terraform. To silence this warning, move the provider version constraint into the requiredproviders block. Error: Failed to query available provider packages Could not retrieve the list of available versions for provider hashicorp/ionoscloud: provider registry registry.terraform.io does not have a provider named registry.terraform.io/hashicorp/ionoscloud If you have just upgraded directly from Terraform v0.12 to Terraform v0.14 then please upgrade to Terraform v0.13 first and follow the upgrade guide for that release, which might help you address this problem.

I think it would be helpful for new users to have a working example that shows them how to start with terraform and ionosCloud API: (I guess the required_providers block points to the correct source and that does the trick :) )

_terraform { requiredproviders { ionoscloud = { source = "ionos-cloud/ionoscloud" version = "~> 5.0.0" } } } provider "ionoscloud" { username = "$removed" password = "$removed" }

Best Regards

jbuchhammer commented 3 years ago

In the meantime it is fixed and displayed correctly in the repo and registry