PaloAltoNetworks / terraform-provider-prismacloudcompute

Terraform provider for Prisma Cloud Compute
https://registry.terraform.io/providers/PaloAltoNetworks/prismacloudcompute/latest
Mozilla Public License 2.0
24 stars 28 forks source link

Support authenticating without config #43

Closed jasonckeating closed 2 years ago

jasonckeating commented 2 years ago

Describe the bug

Authentication with username/password still does not work.

Expected behavior

Configuring authentication with usernames and passwords should work without errors.

Current behavior

When configuring compute with the following:

provider "prismacloudcompute" {
  # Configuration options  
  username    = var.PRISMACLOUD_USERNAME
  password    = var.PRISMACLOUD_PASSWORD
  console_url = "us-west1.cloud.twistlock.com/us-12345678"
}

The following error is experienced.

╷
│ Error: error creating API client: Post "/api/v1/authenticate": unsupported protocol scheme ""
│ 
│   with provider["registry.terraform.io/paloaltonetworks/prismacloudcompute"],
│   on main.tf line 15, in provider "prismacloudcompute":
│   15: provider "prismacloudcompute" {
│ 
╵

Possible solution

Steps to reproduce

  1. Configure Prisma Cloud Compute without a config file.
  2. tf init
  3. tf plan

Screenshots

Context

Cannot use the Prisma Cloud Compute provider to manage large number of accounts int he compute section of Prisma.

Your Environment

welcome-to-palo-alto-networks[bot] commented 2 years ago

:tada: Thanks for opening your first issue here! Welcome to the community!

jasonckeating commented 2 years ago

Adding another error using v0.3.0 of this provider.

│ 
│ Error: error creating API client: error authenticating: error POSTing to authenticate endpoint: Post "/api/v1/authenticate?project=": unsupported protocol scheme ""
│ 
│   with provider["registry.terraform.io/paloaltonetworks/prismacloudcompute"],
│   on main.tf line 15, in provider "prismacloudcompute":
│   15: provider "prismacloudcompute" {
│ 
wfg commented 2 years ago

@jasonckeating thanks for bringing this to my attention. There was a problem with how I was building the URL that only presented itself when the Console URL had a path other than / (so all SaaS Consoles). It's fixed in v0.4.0.

jasonckeating commented 2 years ago

Thanks @wfg, I'm getting a similar error on v0.4.0.

|
│ Error: error creating API client: error authenticating: error POSTing to authenticate endpoint: Post "us-west1.cloud.twistlock.com/us-12345678/api/v1/authenticate": unsupported protocol scheme ""
│ 
│   with provider["registry.terraform.io/paloaltonetworks/prismacloudcompute"],
│   on main.tf line 15, in provider "prismacloudcompute":
│   15: provider "prismacloudcompute" {
│ 
wfg commented 2 years ago

Ahh.. The https:// prefix is required. In a future version, I'll have it default to HTTPS if not supplied.

jasonckeating commented 2 years ago

ah, thanks, updated and got the plan