site24x7 / terraform-provider-site24x7

Terraform provider for Site24x7
MIT License
22 stars 33 forks source link

site24x7_website_monitor website field - basic auth didn't works #200

Closed anthosz closed 10 months ago

anthosz commented 1 year ago

Hello,

When we set a new website with auth_user & auth_pass:

resource "site24x7_website_monitor" "test" {
  auth_user                 = "user"
  auth_pass                 = "pass"
  [...]
}

It didn't works, I receive on the monitor a 401 "The request requires user authentication.".

If I go directly to the GUI and edit the password of the web credentials, it works until I reapply the terraform.

Another issue is that after each plan/apply of terraform, every credential_profile_id are removed/recreated.

ponkuma123 commented 11 months ago

We are planning to bring auth credentials like the auth_user and auth_pass to the Credential Profile. This can enable you to use the auth credentials for multiple monitors in your account.

Also, we can't update the auth_user and auth_pass values now. This is being taken up as a feature request and we'll be informing you once the feature is ready.

anthosz commented 10 months ago

Dear @ponkuma123 ,

Do you have any news about this request?

Best regards,

ponkuma123 commented 10 months ago

@anthosz You create the credential profile instead of using auth_name and auth_pass. ref this create credential profile: https://github.com/site24x7/terraform-provider-site24x7/blob/main/examples/credential_profiles_us.tf and then use the credential profile id while creating the monitor. eg: { credential_profile_id = "123" }

thank you ....!

anthosz commented 10 months ago

@ponkuma123 thank you but it seems it didn't works:

resource "site24x7_credential_profile" "profiles" {
  credential_name = "test"
  credential_type = 3
  username        = "test"
  password        = "test"
}

Error:

 Error: The OAuth Scope associated with this OAuth Access Token is not allowed for the api.
│ 
│   with site24x7_credential_profile.profiles["XXXX"],
│   on probes.tf line 1, in resource "site24x7_credential_profile" "profiles":
│    1: resource "site24x7_credential_profile" "profiles" {

Current scopes: Site24x7.Admin.All,Site24x7.Account.All,Site24x7.Operations.All,Site24x7.Bu.Read

Moreover, it is possible to hidden the value of password during the plan?

Thank you!

ponkuma123 commented 10 months ago

@anthosz kindly create a Oauth Token using "Site24x7.Account.All,Site24x7.Admin.All,Site24x7.Reports.All,Site24x7.Operations.All,Site 24x7.Msp.All,Site24x7.Bu.All,Site24x7.Internal.All" auth scope

anthosz commented 10 months ago

Thank you!