<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem authenticating with SCA using the Terraform Provider in Secure Cloud Access (SCA) Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423409#M110</link>
    <description>&lt;P&gt;Thanks Rajnish in updating the thread. Adding below details for anyone else to know where to add the scope.&lt;span class="lia-inline-image-display-wrapper" image-alt="Field_Content_versions_oct20__068Vy00000z5RhHIAU.png"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/94224iBE6812EE65DCB4B0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Field_Content_versions_oct20__068Vy00000z5RhHIAU.png" alt="Field_Content_versions_oct20__068Vy00000z5RhHIAU.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Nov 2025 03:54:42 GMT</pubDate>
    <dc:creator>CyberArkAlumni</dc:creator>
    <dc:date>2025-11-13T03:54:42Z</dc:date>
    <item>
      <title>Problem authenticating with SCA using the Terraform Provider</title>
      <link>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423404#M105</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We've been having trouble getting the Cyberark SCA terraform provider to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have tested the linux terraform-provider-sca_linux_amd64.zip provider versions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Version: v0.1022.1&lt;/LI&gt;&lt;LI&gt;Version: v0.1024.3&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;They both had the same issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our debugging led us to believe that the service credentials we've created for the terraform provider ARE successfully generating a valid JWT, however when the token is used the provider is failing, either incorrect permissions or the JWT is not accepted (401 error).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've confirmed this by using curl to generate myself a JWT from the cyberark oauth endpoint:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;CODE&gt;curl -X POST https://xxxx.id.cyberark.cloud/oauth2/token/TerraformIntegration \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -u "${USERNAME}:${PASSWORD}" \
 -d "grant_type=client_credentials"
&amp;nbsp;
{
 "auth_time": 1761795357,
 "iss": "https://xxxx.id.cyberark.cloud/TerraformIntegration/",
 "iat": 1761795625,
 "aud": "cyberark.isp.sca",
 "unique_name": "terraformintegration@cyberark.cloud.xxxx",
 "user_roles": [
  "DpaAdmin",
  "CEMAdmin",
  "Terraform SCA",
  "CS Admin",
  "SCAApiFullAccess",
  "SCA Admin",
  "Connector Management Admin",
  "Cloud Onboarding Admin",
  "TDR Administrator",
  "global auditor",
  "TDR Read-only"
 ],
 "user_uuid": "xxxx-xxxx-xxxx-xxxx-xxxx",
 "exp": 1762227625,
 "sub": "xxxx-xxxx-xxxx-xxxx-xxxx",
 "tenant_id": "xxxx-xxxx-xxxx-xxxx-xxxx",
 "app_id": "TerraformIntegration"
}&lt;/CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When we use Terraform provider for SCA we get a 401.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the terraform code we've used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;CODE&gt;data "sca_discovery" "discovery_example" {
 csp      = "AWS"
 organization_id = "r-xxxx"
 account_info  = {
  id     = "xxxx"
  new_account = false
 }
}
&amp;nbsp;
&amp;nbsp;
terraform {
 required_providers {
  sca = {
   # Provider version is 1.0.0
   source = "cyberark/sca/sca"
  }
 }
}
&amp;nbsp;
provider "sca" {
 auth_url      = "https://xxxx.id.cyberark.cloud/oauth2/token/TerraformIntegration"
 tenant_domain_name = "xxxx"
 platform_domain_name = "cyberark.cloud"
 username      = "terraformintegration@cyberark.cloud.xxxx"
 password      = "XXX"
 debug        = true
}&lt;/CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error we get is:&lt;/P&gt;&lt;CODE&gt;$ terraform plan
data.sca_discovery.discovery_example: Reading...
Planning failed. Terraform encountered an error while generating this plan.
╷
│ Error: Unable to active discovery
│ 
│ with data.sca_discovery.discovery_example,
│ on terraform.tf line 1, in data "sca_discovery" "discovery_example":
│  1: data "sca_discovery" "discovery_example" {
│ 
│ Error while sending discovery request: Got status code different than 200.Status code is 401 Unauthorized&lt;/CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The DEBUG logs are a bit more detailed but show initial success at authenticating (presumably getting the JWT successfully, like I've done manually above), but then failing to use the JWT&lt;/P&gt;&lt;CODE&gt;2025-10-30T15:01:37.466+1100 [DEBUG] ReferenceTransformer: "data.sca_discovery.discovery_example" references: []
2025-10-30T15:01:37.467+1100 [DEBUG] skipping FixUpBlockAttrs
2025-10-30T15:01:37.468+1100 [INFO]  provider.terraform-provider-sca_linux_amd64: Signed in successfully: SCA_auth_url=https://xxxx.id.cyberark.cloud/oauth2/token/TerraformIntegration SCA_debug=true SCA_password="***" tf_rpc=ConfigureProvider @module=sca SCA_base_url=https://xxxx.sca.cyberark.cloud/api SCA_username=terraformintegration@cyberark.cloud.xxxx tf_provider_addr=cyberark/sca/sca tf_req_id=xxxx-xxxx-xxxx-xxxx-xxxx @caller=/home/jenkins/agent/workspace/cloud-sec-self-services/services/internal-deploy/integrations-v0.1024.3-prod-ap-southeast-2/terraform-provider-sca/sca/provider/provider.go:251 timestamp="2025-10-30T15:01:37.465+1100"
2025-10-30T15:01:37.468+1100 [INFO]  provider.terraform-provider-sca_linux_amd64: Configured SCA client: @module=sca SCA_auth_url=https://xxxx.id.cyberark.cloud/oauth2/token/TerraformIntegration SCA_base_url=https://xxxx.sca.cyberark.cloud/api SCA_debug=true SCA_password="***" SCA_username=terraformintegration@cyberark.cloud.xxxx success=true tf_provider_addr=cyberark/sca/sca tf_req_id=xxxx-xxxx-xxxx-xxxx-xxxx tf_rpc=ConfigureProvider @caller=/home/jenkins/agent/workspace/cloud-sec-self-services/services/internal-deploy/integrations-v0.1024.3-prod-ap-southeast-2/terraform-provider-sca/sca/provider/provider.go:257 timestamp="2025-10-30T15:01:37.465+1100"
data.sca_discovery.discovery_example: Reading...
2025-10-30T15:01:37.476+1100 [INFO]  provider.terraform-provider-sca_linux_amd64: Starting to create policy: tf_provider_addr=cyberark/sca/sca tf_rpc=ReadDataSource @module=sca tf_data_source_type=sca_discovery tf_req_id=xxxx-xxxx-xxxx-xxxx-xxxx @caller=/home/jenkins/agent/workspace/cloud-sec-self-services/services/internal-deploy/integrations-v0.1024.3-prod-ap-southeast-2/terraform-provider-sca/sca/cloud_discovery/bl/data_source/discovery/discovery_data_resource.go:94 timestamp="2025-10-30T15:01:37.473+1100"
2025-10-30T15:01:37.645+1100 [DEBUG] provider.terraform-provider-sca_linux_amd64: Response body: {"message":"Unauthorized"}: @module=sca tf_data_source_type=sca_discovery tf_provider_addr=cyberark/sca/sca tf_req_id=xxxx-xxxx-xxxx-xxxx-xxxx tf_rpc=ReadDataSource @caller=/home/jenkins/agent/workspace/cloud-sec-self-services/services/internal-deploy/integrations-v0.1024.3-prod-ap-southeast-2/terraform-provider-sca/sca/client/client_utils.go:26 timestamp="2025-10-30T15:01:37.645+1100"
2025-10-30T15:01:37.645+1100 [ERROR] provider.terraform-provider-sca_linux_amd64: Response contains error diagnostic: @caller=/home/jenkins/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov6/internal/diag/diagnostics.go:58 @module=sdk.proto diagnostic_severity=ERROR diagnostic_summary="Unable to active discovery" tf_data_source_type=sca_discovery tf_req_id=xxxx-xxxx-xxxx-xxxx-xxxx diagnostic_detail="Error while sending discovery request: Got status code different than 200.Status code is 401 Unauthorized" tf_proto_version=6.4 tf_provider_addr=cyberark/sca/sca tf_rpc=ReadDataSource timestamp="2025-10-30T15:01:37.645+1100"&lt;/CODE&gt;&lt;P&gt;To me this seems an authorization problem - did we not give the correct permissions to the service user?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried with another data resource, and tried creating a resource and I still just get the 401 Unauthorized.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We'd&amp;nbsp;love some further guidance on how this issue could be resolved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2025 07:40:21 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423404#M105</guid>
      <dc:creator>DTo</dc:creator>
      <dc:date>2025-11-07T07:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Problem authenticating with SCA using the Terraform Provider</title>
      <link>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423405#M106</link>
      <description>&lt;P&gt;Hello, For the username you are generating the JWT, please ensure that service user is associated to below roles. &lt;/P&gt;&lt;P&gt;Please note: If you don't have below SCAPublicApiWrapper role, then please create one and add roles SCAApiFullAccess, SCAApiFullAccess as members of this role&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Field_Content_versions_oct20__068Vy00000yD6v0IAC.png"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/94176iA53541C15D209B19/image-size/large?v=v2&amp;amp;px=999" role="button" title="Field_Content_versions_oct20__068Vy00000yD6v0IAC.png" alt="Field_Content_versions_oct20__068Vy00000yD6v0IAC.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2025 08:16:18 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423405#M106</guid>
      <dc:creator>CyberArkAlumni</dc:creator>
      <dc:date>2025-11-07T08:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem authenticating with SCA using the Terraform Provider</title>
      <link>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423406#M107</link>
      <description>&lt;P&gt;Hi Sunit,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your very quick response!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've worked with my colleague who has granted the permissions you've suggested. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We also assumed that the SCAPublicApiWrapper role should include SCAApiFullAccess and SCAApiReadOnly, rather than what you had posted SCAApiFullAccess and SCAApiFullAccess.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can confirm these three roles have been given, see: &lt;/P&gt;&lt;CODE&gt;{
 "auth_time": 1762728182,
 "iss": "https://xxxx.id.cyberark.cloud/TerraformIntegration/",
 "iat": 1762728196,
 "aud": "cyberark.isp.sca",
 "unique_name": "terraformintegration@cyberark.cloud.xxxxx",
 "user_roles": [
  "DpaAdmin",
  "CEMAdmin",
  "Terraform SCA",
  "CS Admin",
  "SCAApiFullAccess",
  "SCA Admin",
  "SCAUserReadOnly",
  "SCAApiReadOnly",
  "Connector Management Admin",
  "Cloud Onboarding Admin",
  "TDR Administrator",
  "Access Request Applicant",
  "Access Request Approver",
  "SCAPublicApiWrapper",
  "global auditor",
  "TDR Read-only"
 ],
 "user_uuid": "xxxx-xxxx-xxxx-xxxx-xxxx",
 "exp": 1763160196,
 "sub": "xxxx-xxxx-xxxx-xxxx-xxxx",
 "tenant_id": "xxxx-xxxx-xxxx-xxxx-xxxx",
 "app_id": "TerraformIntegration"
}&lt;/CODE&gt;&lt;P&gt;Also these screen shots: &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Field_Content_versions_oct20__068Vy00000yVORhIAO.png"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/94182i68DBB604EC5E64E0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Field_Content_versions_oct20__068Vy00000yVORhIAO.png" alt="Field_Content_versions_oct20__068Vy00000yVORhIAO.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Field_Content_versions_oct20__068Vy00000yVOTJIA4.png"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/94184iB9099A5F2762A032/image-size/large?v=v2&amp;amp;px=999" role="button" title="Field_Content_versions_oct20__068Vy00000yVOTJIA4.png" alt="Field_Content_versions_oct20__068Vy00000yVOTJIA4.png" /&gt;&lt;/span&gt;I'm afraid that does not work. We still get the 401.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;CODE&gt;$ terraform apply
data.sca_discovery.discovery_example: Reading...
╷
│ Error: Unable to active discovery
│ 
│   with data.sca_discovery.discovery_example,
│   on terraform.tf line 1, in data "sca_discovery" "discovery_example":
│    1: data "sca_discovery" "discovery_example" {
│ 
│ Error while sending discovery request: Got status code different than 200.Status code is 401 Unauthorized
 &lt;/CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know any other reason why authorization is not working? What else can we do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 00:12:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423406#M107</guid>
      <dc:creator>DTo</dc:creator>
      <dc:date>2025-11-10T00:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problem authenticating with SCA using the Terraform Provider</title>
      <link>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423407#M108</link>
      <description>&lt;P&gt;Hi, can you please open a support case here, it may need some debugging since its no longer the case of right access: https://community.cyberark.com/s/Submit-a-Case&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 16:30:07 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423407#M108</guid>
      <dc:creator>CyberArkAlumni</dc:creator>
      <dc:date>2025-11-10T16:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem authenticating with SCA using the Terraform Provider</title>
      <link>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423408#M109</link>
      <description>&lt;P&gt;@Sunit Randhawa​&amp;nbsp;- We managed to resolve the authn issue after adding full scope on the Oauth2 server. We have updated the support team as well.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 23:33:21 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423408#M109</guid>
      <dc:creator>CyberArkAlumni</dc:creator>
      <dc:date>2025-11-12T23:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Problem authenticating with SCA using the Terraform Provider</title>
      <link>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423409#M110</link>
      <description>&lt;P&gt;Thanks Rajnish in updating the thread. Adding below details for anyone else to know where to add the scope.&lt;span class="lia-inline-image-display-wrapper" image-alt="Field_Content_versions_oct20__068Vy00000z5RhHIAU.png"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/94224iBE6812EE65DCB4B0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Field_Content_versions_oct20__068Vy00000z5RhHIAU.png" alt="Field_Content_versions_oct20__068Vy00000z5RhHIAU.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2025 03:54:42 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/secure-cloud-access-sca/problem-authenticating-with-sca-using-the-terraform-provider/m-p/1423409#M110</guid>
      <dc:creator>CyberArkAlumni</dc:creator>
      <dc:date>2025-11-13T03:54:42Z</dc:date>
    </item>
  </channel>
</rss>

