AmpereComputing / terraform-oci-ampere-a1

Terraform for launching OCI Ampere A1 Instances
Apache License 2.0
15 stars 9 forks source link

direct usage not clear #3

Closed dch closed 2 years ago

dch commented 2 years ago

The usual terraform init && terraform apply, using a suitable terraform.tfvars file seems to be missing something important.

> terraform init

Initializing the backend...

Initializing provider plugins...
- Finding latest version of hashicorp/tls...
- Finding latest version of hashicorp/random...
- Finding latest version of hashicorp/oci...
- Finding latest version of hashicorp/local...
- Finding latest version of hashicorp/template...
- Installing hashicorp/template v2.2.0...
- Installed hashicorp/template v2.2.0 (signed by HashiCorp)
- Installing hashicorp/tls v3.2.0...
- Installed hashicorp/tls v3.2.0 (signed by HashiCorp)
- Installing hashicorp/random v3.1.2...
- Installed hashicorp/random v3.1.2 (signed by HashiCorp)
- Installing hashicorp/oci v4.69.0...
- Installed hashicorp/oci v4.69.0 (signed by HashiCorp)
- Installing hashicorp/local v2.2.2...
- Installed hashicorp/local v2.2.2 (signed by HashiCorp)

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.

╷
│ Warning: Additional provider information from registry
│
│ The remote registry returned warnings for registry.terraform.io/hashicorp/oci:
│ - For users on Terraform 0.13 or greater, this provider has moved to oracle/oci. Please update your source in required_providers.
╵

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.
$ terraform apply
╷
│ Error: Invalid provider configuration
│
│ Provider "registry.terraform.io/hashicorp/oci" requires explicit configuration. Add a provider block to the root module and configure the
│ provider's required arguments as described in the provider documentation.
│
╵
╷
│ Error: can not create client, bad configuration: did not find a proper configuration for tenancy
│
│   with provider["registry.terraform.io/hashicorp/oci"],
│   on <empty> line 0:
│   (source code not available)
# ~/.oci/terraform.tfvars
fingerprint         = "57:70:a4:02:65:72:01:8f:33:94:fa:8f:ab:23:17:a1"
user_ocid           = "ocid1.user.oc1..aaaabbcc123"
tenancy_ocid        = "ocid1.tenancy.oc1..aaaabbcc123"
private_key_path    = "~/.oci/oci_api.pem"
ppouliot commented 2 years ago

you need to pass in your oci creds and the path to the cert file.

On Mon, Apr 4, 2022, 3:37 PM Dave Cottlehuber @.***> wrote:

The usual terraform init && terraform apply, using a suitable terraform.tfvars file seems to be missing something important.

terraform init

Initializing the backend...

Initializing provider plugins...

  • Finding latest version of hashicorp/tls...

  • Finding latest version of hashicorp/random...

  • Finding latest version of hashicorp/oci...

  • Finding latest version of hashicorp/local...

  • Finding latest version of hashicorp/template...

  • Installing hashicorp/template v2.2.0...

  • Installed hashicorp/template v2.2.0 (signed by HashiCorp)

  • Installing hashicorp/tls v3.2.0...

  • Installed hashicorp/tls v3.2.0 (signed by HashiCorp)

  • Installing hashicorp/random v3.1.2...

  • Installed hashicorp/random v3.1.2 (signed by HashiCorp)

  • Installing hashicorp/oci v4.69.0...

  • Installed hashicorp/oci v4.69.0 (signed by HashiCorp)

  • Installing hashicorp/local v2.2.2...

  • Installed hashicorp/local v2.2.2 (signed by HashiCorp)

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.

│ Warning: Additional provider information from registry

│ The remote registry returned warnings for registry.terraform.io/hashicorp/oci:

│ - For users on Terraform 0.13 or greater, this provider has moved to oracle/oci. Please update your source in required_providers.

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.

  • but then

$ terraform apply

│ Error: Invalid provider configuration

│ Provider "registry.terraform.io/hashicorp/oci" requires explicit configuration. Add a provider block to the root module and configure the

│ provider's required arguments as described in the provider documentation.

│ Error: can not create client, bad configuration: did not find a proper configuration for tenancy

│ with provider["registry.terraform.io/hashicorp/oci"],

│ on line 0:

│ (source code not available)

~/.oci/terraform.tfvars

fingerprint = "57:70:a4:02:65:72:01:8f:33:94:fa:8f:ab:23:17:a1"

user_ocid = "ocid1.user.oc1..aaaabbcc123"

tenancy_ocid = "ocid1.tenancy.oc1..aaaabbcc123"

private_key_path = "~/.oci/oci_api.pem"

— Reply to this email directly, view it on GitHub https://github.com/AmpereComputing/terraform-oci-ampere-a1/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALXJ4OTSWTKATZ72Q6AU73VDNAFVANCNFSM5SQRJUAA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ppouliot commented 2 years ago

Updating readme to include path to cert file should help with the issue.