Skip to content

Update documentation to reflect Terraform 0.13 registry-based install #32

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

Open
nbering opened this issue Aug 29, 2020 · 6 comments
Open
Labels
documentation This issue pertains to a potential documentation enhancement.

Comments

@nbering
Copy link
Owner

nbering commented Aug 29, 2020

No description provided.

@nbering nbering added the documentation This issue pertains to a potential documentation enhancement. label Aug 29, 2020
@nbering nbering changed the title Update documentation to reflect 0.13 registry-based install Update documentation to reflect Terraform 0.13 registry-based install Aug 29, 2020
@bdelvecchio
Copy link

bdelvecchio commented Aug 31, 2020

[SOLVED--see below]

@nbering I'm trying to update to terraform 0.13.1. Can you share any clues on how to switch to the registry?

I can see it here at https://registry.terraform.io/providers/nbering/ansible/latest
I've added this block:

terraform {
  [...]
  required_providers {
    ansible = {
      source = "nbering/ansible"
      version = "1.0.4"
    }
  }
}

but terraform is looking for -/ansible, even after installing bbering/ansible:

 $ terraform init
Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Using previously-installed nbering/ansible v1.0.4
- Using previously-installed hashicorp/aws v3.4.0
- Using previously-installed -/aws v3.4.0
- Finding latest version of hashicorp/ansible...
- Finding latest version of -/ansible...

Error: Failed to query available provider packages

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


Error: Failed to install provider

Error while installing hashicorp/ansible: provider registry
registry.terraform.io does not have a provider named
registry.terraform.io/hashicorp/ansible
 $ terraform version
Terraform v0.13.1
+ provider registry.terraform.io/-/aws v3.4.0
+ provider registry.terraform.io/hashicorp/aws v3.4.0
+ provider registry.terraform.io/nbering/ansible v1.0.4

@bdelvecchio
Copy link

bdelvecchio commented Sep 1, 2020

I figured out the upgrade procedure: 'terraforom replace-provider' will convert the resources defined locally in your project:

 $ tf state replace-provider registry.terraform.io/-/ansible registry.terraform.io/nbering/ansible
Terraform will perform the following actions:

  ~ Updating provider:
    - registry.terraform.io/-/ansible
    + registry.terraform.io/nbering/ansible

Changing 3 resources:

  ansible_host.monitor
  module.swarm_master.ansible_group.swarm_nodes
  module.swarm_master.ansible_host.swarm_master

Do you want to make these changes?
Only 'yes' will be accepted to continue.

Enter a value: yes

Successfully replaced provider for 3 resources.

NOTE that any modules which use nbering/ansible also need a required_providers declaration for it.

@nbering
Copy link
Owner Author

nbering commented Sep 1, 2020

Ah. I think I see what's going on there during the upgrade. It's stored a provider reference in your statefile and you need to upgrade that. That's good to note... it might happen the other-way-round too, if someone wants to fork the provider to make changes.

@bdelvecchio
Copy link

@nbering I don't think I totally solved this problem after all. I've upgraded my state with tf state replace-provider, added required_provider blocks in this project and all the modules it uses:

terraform {
  required_providers {
    ansible = {
      source = "nbering/ansible"
      version = "1.0.4"
    }
    aws = {
      source = "hashicorp/aws"
    }
  }
}

and terraform is still looking for the obsolete hashicorp/ansible:

 $ tf init
Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Using previously-installed -/aws v3.5.0
- Using previously-installed nbering/ansible v1.0.4
- Using previously-installed hashicorp/aws v3.5.0
- Finding latest version of hashicorp/ansible...

Error: Failed to install provider

Error while installing hashicorp/ansible: provider registry
registry.terraform.io does not have a provider named
registry.terraform.io/hashicorp/ansible

@nbering
Copy link
Owner Author

nbering commented Sep 8, 2020

@bdelvecchio Can you open a separate ticket for this? I had intended this one just to cover the documentation update, but it sounds like you need some troubleshooting. If you can find anything upstream from https://github.com/hashicorp/terraform, that might help you as well. In honesty, I haven't updated to 0.13 for my projects, yet... I usually wait a while because the early versions of Terraform major releases tend to be a little buggy.

@bdelvecchio
Copy link

sorry for taking over this issue! I'll open another one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This issue pertains to a potential documentation enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants