puppetlabs / puppetlabs-pecdm

Puppet Bolt driven fusion of puppetlabs/peadm and Terraform.
Apache License 2.0
14 stars 18 forks source link

Terraform plug-in sbitio/hiera5 not availble for ARM macOS causes pecdm::provision to fail #76

Closed Sharpie closed 1 year ago

Sharpie commented 1 year ago

Describe the Bug

The pecdm module fails when used on an ARM architecture Mac due to the sbitio/hiera5 Terraform plug-in not being available.

Expected Behavior

The pecdm module is compatible with Mac hardware using ARM processors.

Steps to Reproduce

Attempt to Provision a GCE environment from an ARM-based Mac:

bolt plan run pecdm::provision project=example ssh_user=john.doe provider=google firewall_allow='[ "0.0.0.0/0" ]'

Provisioning fails with an error about Terraform dependencies:

Starting: plan pecdm::provision
Starting: task terraform::initialize on localhost
Finished: task terraform::initialize with 0 failures in 0.1 sec
Starting: plan terraform::apply
Starting: task terraform::apply on localhost
Finished: task terraform::apply with 1 failure in 0.14 sec
Finished: plan terraform::apply in 0.15 sec
Finished: plan pecdm::provision in 1.47 sec
Failed on localhost:

  Error: Inconsistent dependency lock file

  The following dependency selections recorded in the lock file are
  inconsistent with the current configuration:
    - provider registry.terraform.io/hashicorp/google: required by this configuration but no version is selected
    - provider registry.terraform.io/hashicorp/random: required by this configuration but no version is selected
    - provider registry.terraform.io/sbitio/hiera5: required by this configuration but no version is selected

  To make the initial dependency selections that will initialize the dependency
  lock file, run:
    terraform init
Failed on 1 target: localhost
Ran on 1 target

Running terraform init directly in the .terraform/google_pe_arch directory provides more info:

cd .terraform/google_pe_arch
terraform init
Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/random versions matching "3.1.0"...
- Finding sbitio/hiera5 versions matching "0.2.7"...
- Finding hashicorp/google versions matching "3.68.0"...
- Installing hashicorp/random v3.1.0...
- Installed hashicorp/random v3.1.0 (signed by HashiCorp)
- Installing hashicorp/google v3.68.0...
- Installed hashicorp/google v3.68.0 (signed by HashiCorp)
╷
│ Error: Incompatible provider version
│
│ Provider registry.terraform.io/sbitio/hiera5 v0.2.7 does not have a package available for your current platform, darwin_arm64.
│
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of
│ this provider may have different platforms supported. 

Environment

ody commented 1 year ago

@Sharpie I do not have an ARM Macbook, could you test the branch of the Google Terraform module which I've pushed? https://github.com/puppetlabs/terraform-google-pe_arch/tree/local_hiera_mirror

Sharpie commented 1 year ago

No joy. I update the pecdm Puppetfile:

diff --git a/Puppetfile b/Puppetfile
index ac61008..4ad2d65 100644
--- a/Puppetfile
+++ b/Puppetfile
@@ -25,7 +25,7 @@ mod 'puppetlabs-peadm',
 #
 mod 'terraform-google_pe_arch',
     git:          'https://github.com/puppetlabs/terraform-google-pe_arch.git',
-    ref:          '651c95fb058d050476f496234ad97467b349d937',
+    branch:          'local_hiera_mirror',
     install_path: '.terraform'

 mod 'terraform-aws_pe_arch',

Then removed the .modules and .terraform directories and ran bolt module install --no-resolve. The pecdm::provision provision plan still fails:

 $ bolt plan run pecdm::provision project=example ssh_user=john.doe provider=google firewall_allow='[ "0.0.0.0/0" ]'
Starting: plan pecdm::provision
Starting: task terraform::initialize on localhost
Finished: task terraform::initialize with 1 failure in 3.59 sec
Finished: plan pecdm::provision in 5.83 sec
Failed on localhost:
  undefined method `_' for #<TerraformInitialize:0x00007febef198650>
Failed on 1 target: localhost
Ran on 1 target

$ bolt plan run pecdm::provision project=example ssh_user=john.doe provider=google firewall_allow='[ "0.0.0.0/0" ]'
--trace
Starting: plan pecdm::provision
Starting: task terraform::initialize on localhost
Finished: task terraform::initialize with 0 failures in 0.2 sec
Starting: plan terraform::apply
Starting: task terraform::apply on localhost
Finished: task terraform::apply with 1 failure in 0.26 sec
Finished: plan terraform::apply in 0.27 sec
Finished: plan pecdm::provision in 2.86 sec
Failed on localhost:

  Error: Inconsistent dependency lock file

  The following dependency selections recorded in the lock file are
  inconsistent with the current configuration:
    - provider registry.terraform.io/hashicorp/google: required by this configuration but no version is selected
    - provider registry.terraform.io/hashicorp/random: required by this configuration but no version is selected
    - provider registry.terraform.io/sbitio/hiera5: required by this configuration but no version is selected

  To make the initial dependency selections that will initialize the dependency
  lock file, run:
    terraform init
Failed on 1 target: localhost
Ran on 1 target

$ cd .terraform/google_pe_arch
$ terraform init
Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Finding sbitio/hiera5 versions matching "0.2.7"...
- Finding hashicorp/google versions matching "3.68.0"...
- Finding hashicorp/random versions matching "3.1.0"...
- Installing hashicorp/google v3.68.0...
- Installed hashicorp/google v3.68.0 (signed by HashiCorp)
- Installing hashicorp/random v3.1.0...
- Installed hashicorp/random v3.1.0 (signed by HashiCorp)
╷
│ Error: Incompatible provider version
│
│ Provider registry.terraform.io/sbitio/hiera5 v0.2.7 does not have a package available for your current platform, darwin_arm64.
│
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of
│ this provider may have different platforms supported.
davidsandilands commented 1 year ago

@Sharpie I think this may have been forked https://registry.terraform.io/providers/chriskuchin/hiera5/latest could you try using chriskuchin/hiera5 ?

davidsandilands commented 1 year ago

@Sharpie We have merged https://github.com/puppetlabs/puppetlabs-pecdm/pull/82 which uses the new plugin can you let us know if that works