Skip to content

Commit 4c4ee16

Browse files
IDSEC-000: Consume SDK for proxy and retry additions
1 parent c5bc44b commit 4c4ee16

File tree

7 files changed

+42
-5
lines changed

7 files changed

+42
-5
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.13
1+
0.1.14

docs/data-sources/pcloud_account.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ data "idsec_pcloud_account" "example_account" {
2626
### Optional
2727

2828
- `access_restricted_to_remote_machines` (Boolean) Whether to restrict access only to the specified remote machines
29+
- `account_name` (String) The name of the account to retrieve the account's details
2930
- `address` (String) The name or address of the machine where the account is used
3031
- `automatic_management_enabled` (Boolean) Whether the account secret is managed automatically
3132
- `category_modification_time` (Number) The last time the account or one of its file categories was created or changed

docs/data-sources/pcloud_safe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ data "idsec_pcloud_safe" "example_safe" {
3636
- `number_of_days_retention` (Number) The number of days that secrets versions are saved in the Safe
3737
- `number_of_versions_retention` (Number) The number of retained versions of every secret that is stored in the Safe
3838
- `olac_enabled` (Boolean) Whether Object Level Access Control is enabled
39-
- `safe_name` (String) The unique ID of the Safe used when calling Safe APIs
39+
- `safe_name` (String) The name of the Safe for retrieving the Safe's details
4040
- `safe_number` (Number) The unique numerical ID of the Safe
4141

4242
<a id="nestedatt--creator"></a>

docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ resource "idsec_sia_access_connector" "example_connector" {
8181

8282
- `auth_method` (String) Authentication method. Defaults to `identity`. When set to `identity`, both `username` and `secret` are **required**. When set to `identity_service_user`, both `service_user` and `service_token` are **required**. Resolved from environment variable `IDSEC_AUTH_METHOD`.
8383
- `cache_authentication` (Boolean) Cache authentication for the provider. Defaults to `true`. Resolved from environment variable `IDSEC_CACHE_AUTHENTICATION`.
84+
- `proxy_address` (String) Proxy address for the provider to use for outgoing requests. Resolved from environment variable `IDSEC_PROXY_ADDRESS`. or the standard `HTTPS_PROXY`/`HTTP_PROXY` env vars.
85+
- `proxy_password` (String, Sensitive) Proxy password for the provider to use for outgoing requests. Resolved from environment variable `IDSEC_PROXY_PASSWORD`.
86+
- `proxy_username` (String) Proxy username for the provider to use for outgoing requests. Resolved from environment variable `IDSEC_PROXY_USERNAME`.
8487
- `secret` (String, Sensitive) Secret for identity authentication. **Required** when `auth_method` is `identity` (default). Resolved from environment variable `IDSEC_SECRET`.
8588
- `service_authorized_app` (String) Authorized application for identity service user authentication. Used when `auth_method` is `identity_service_user`. Defaults to `__idaptive_cybr_user_oidc`. Resolved from environment variable `IDSEC_SERVICE_AUTHORIZED_APP`.
8689
- `service_token` (String, Sensitive) Service token for identity service user authentication. **Required** when `auth_method` is `identity_service_user`. Resolved from environment variable `IDSEC_SERVICE_TOKEN`.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/cyberark/terraform-provider-idsec
33
go 1.24.0
44

55
require (
6-
github.com/cyberark/idsec-sdk-golang v0.1.11
6+
github.com/cyberark/idsec-sdk-golang v0.1.12
77
github.com/hashicorp/terraform-plugin-framework v1.15.0
88
github.com/hashicorp/terraform-plugin-go v0.29.0
99
github.com/hashicorp/terraform-plugin-log v0.9.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZ
4141
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
4242
github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI=
4343
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
44-
github.com/cyberark/idsec-sdk-golang v0.1.11 h1:rmQWjV2ze5OdjwF6FS1kHMstR2p9Whc55cRbMAfaQZE=
45-
github.com/cyberark/idsec-sdk-golang v0.1.11/go.mod h1:JlvuO467wokG0Yw43uaIDU0vxtsKT9HpDHapP0fBD6o=
44+
github.com/cyberark/idsec-sdk-golang v0.1.12 h1:7DX0ChsLWd/40W/nNAbmVL48JBbmFEPfUEGZup1BwhY=
45+
github.com/cyberark/idsec-sdk-golang v0.1.12/go.mod h1:JlvuO467wokG0Yw43uaIDU0vxtsKT9HpDHapP0fBD6o=
4646
github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s=
4747
github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI=
4848
github.com/danieljoos/wincred v1.2.2 h1:774zMFJrqaeYCK2W57BgAem/MLi6mtSE47MB6BOJ0i0=

internal/provider/idsec_provider.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/hashicorp/terraform-plugin-framework/types"
1919
"github.com/hashicorp/terraform-plugin-log/tflog"
2020
"github.com/cyberark/idsec-sdk-golang/pkg/auth"
21+
idsecconfig "github.com/cyberark/idsec-sdk-golang/pkg/config"
2122
"github.com/cyberark/idsec-sdk-golang/pkg/models/actions"
2223
authmodels "github.com/cyberark/idsec-sdk-golang/pkg/models/auth"
2324
"github.com/cyberark/idsec-sdk-golang/pkg/services"
@@ -68,6 +69,9 @@ type IdsecProviderSchema struct {
6869
ServiceAuthorizedApp types.String `tfsdk:"service_authorized_app"`
6970
Subdomain types.String `tfsdk:"subdomain"`
7071
CacheAuthentication types.Bool `tfsdk:"cache_authentication"`
72+
ProxyAddress types.String `tfsdk:"proxy_address"`
73+
ProxyUsername types.String `tfsdk:"proxy_username"`
74+
ProxyPassword types.String `tfsdk:"proxy_password"`
7175
}
7276

7377
// IdsecProviderConfig holds the configuration for the Idsec provider.
@@ -173,6 +177,22 @@ func (p *IdsecProvider) Schema(ctx context.Context, req terraformprovider.Schema
173177
Description: "Cache authentication for the provider. Defaults to true. Resolved from environment variable IDSEC_CACHE_AUTHENTICATION.",
174178
MarkdownDescription: "Cache authentication for the provider. Defaults to `true`. Resolved from environment variable `IDSEC_CACHE_AUTHENTICATION`.",
175179
},
180+
"proxy_address": schema.StringAttribute{
181+
Optional: true,
182+
Description: "Proxy address for the provider to use for outgoing requests. Resolved from environment variable IDSEC_PROXY_ADDRESS. or the standard HTTPS_PROXY/HTTP_PROXY env vars.",
183+
MarkdownDescription: "Proxy address for the provider to use for outgoing requests. Resolved from environment variable `IDSEC_PROXY_ADDRESS`. or the standard `HTTPS_PROXY`/`HTTP_PROXY` env vars.",
184+
},
185+
"proxy_username": schema.StringAttribute{
186+
Optional: true,
187+
Description: "Proxy username for the provider to use for outgoing requests. Resolved from environment variable IDSEC_PROXY_USERNAME.",
188+
MarkdownDescription: "Proxy username for the provider to use for outgoing requests. Resolved from environment variable `IDSEC_PROXY_USERNAME`.",
189+
},
190+
"proxy_password": schema.StringAttribute{
191+
Optional: true,
192+
Description: "Proxy password for the provider to use for outgoing requests. Resolved from environment variable IDSEC_PROXY_PASSWORD.",
193+
MarkdownDescription: "Proxy password for the provider to use for outgoing requests. Resolved from environment variable `IDSEC_PROXY_PASSWORD`.",
194+
Sensitive: true,
195+
},
176196
},
177197
}
178198
}
@@ -193,6 +213,19 @@ func (p *IdsecProvider) Configure(ctx context.Context, req terraformprovider.Con
193213
config.CacheAuthentication = p.resolveTerraformBoolVar(config.CacheAuthentication, IdsecCacheAuthenticationEnvVar, IdsecCacheAuthenticationDefault)
194214
config.AuthMethod = p.resolveTerraformStringVar(config.AuthMethod, IdsecAuthMethodEnvVar)
195215
config.Subdomain = p.resolveTerraformStringVar(config.Subdomain, IdsecSubdomainEnvVar)
216+
217+
// If no proxy is set in TF or in env vars, HTTPS_PROXY and HTTP_PROXY env vars will be used as the standard fallback by the SDK.
218+
config.ProxyAddress = p.resolveTerraformStringVar(config.ProxyAddress, idsecconfig.IdsecProxyAddressEnvVar)
219+
config.ProxyUsername = p.resolveTerraformStringVar(config.ProxyUsername, idsecconfig.IdsecProxyUsernameEnvVar)
220+
config.ProxyPassword = p.resolveTerraformStringVar(config.ProxyPassword, idsecconfig.IdsecProxyPasswordEnvVar)
221+
if !config.ProxyAddress.IsNull() {
222+
idsecconfig.SetProxyAddress(config.ProxyAddress.String())
223+
}
224+
if !config.ProxyUsername.IsNull() && !config.ProxyPassword.IsNull() {
225+
idsecconfig.SetProxyUsername(config.ProxyUsername.String())
226+
idsecconfig.SetProxyPassword(config.ProxyPassword.String())
227+
}
228+
196229
if config.AuthMethod.IsNull() {
197230
resp.Diagnostics.AddError("Invalid Configuration", "Auth method is required.")
198231
return

0 commit comments

Comments
 (0)