Skip to content

Commit 2728f52

Browse files
committed
create a type model for data source saml settings that does not conflict with the resource model. Update docs
1 parent 14adcf9 commit 2728f52

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ ENHANCEMENTS:
2323

2424
* resource/tfe_organization_run_task: Add `hmac_key_wo` write-only attribute, by @shwetamurali ([#1646](https://github.com/hashicorp/terraform-provider-tfe/pull/1646))
2525

26+
* resource/tfe_saml_settings: Add `private_key_wo` write-only attribute, by @uturunku1 ([#1660](https://github.com/hashicorp/terraform-provider-tfe/pull/1660))
27+
2628
## v.0.64.0
2729

2830
FEATURES:

internal/provider/data_source_saml_settings.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ type dataSourceTFESAMLSettings struct {
2929
client *tfe.Client
3030
}
3131

32-
// modelTFESAMLSettings maps the data source schema data.
33-
type modelTFESAMLSettings struct {
32+
// modelDataTFESAMLSettings maps the data source schema data.
33+
type modelDataTFESAMLSettings struct {
3434
ID types.String `tfsdk:"id"`
3535
Enabled types.Bool `tfsdk:"enabled"`
3636
Debug types.Bool `tfsdk:"debug"`
@@ -50,7 +50,6 @@ type modelTFESAMLSettings struct {
5050
MetadataURL types.String `tfsdk:"metadata_url"`
5151
Certificate types.String `tfsdk:"certificate"`
5252
PrivateKey types.String `tfsdk:"private_key"`
53-
PrivateKeyWO types.String `tfsdk:"private_key_wo"`
5453
SignatureSigningMethod types.String `tfsdk:"signature_signing_method"`
5554
SignatureDigestMethod types.String `tfsdk:"signature_digest_method"`
5655
}
@@ -159,7 +158,7 @@ func (d *dataSourceTFESAMLSettings) Read(ctx context.Context, _ datasource.ReadR
159158
}
160159

161160
// Set state
162-
diags := resp.State.Set(ctx, &modelTFESAMLSettings{
161+
diags := resp.State.Set(ctx, &modelDataTFESAMLSettings{
163162
ID: types.StringValue(s.ID),
164163
Enabled: types.BoolValue(s.Enabled),
165164
Debug: types.BoolValue(s.Debug),

internal/provider/resource_tfe_saml_settings.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,31 @@ const (
3434
samlDefaultSSOAPITokenSessionTimeoutSeconds int64 = 1209600 // 14 days
3535
)
3636

37+
type modelTFESAMLSettings struct {
38+
ID types.String `tfsdk:"id"`
39+
Enabled types.Bool `tfsdk:"enabled"`
40+
Debug types.Bool `tfsdk:"debug"`
41+
TeamManagementEnabled types.Bool `tfsdk:"team_management_enabled"`
42+
AuthnRequestsSigned types.Bool `tfsdk:"authn_requests_signed"`
43+
WantAssertionsSigned types.Bool `tfsdk:"want_assertions_signed"`
44+
IDPCert types.String `tfsdk:"idp_cert"`
45+
OldIDPCert types.String `tfsdk:"old_idp_cert"`
46+
SLOEndpointURL types.String `tfsdk:"slo_endpoint_url"`
47+
SSOEndpointURL types.String `tfsdk:"sso_endpoint_url"`
48+
AttrUsername types.String `tfsdk:"attr_username"`
49+
AttrGroups types.String `tfsdk:"attr_groups"`
50+
AttrSiteAdmin types.String `tfsdk:"attr_site_admin"`
51+
SiteAdminRole types.String `tfsdk:"site_admin_role"`
52+
SSOAPITokenSessionTimeout types.Int64 `tfsdk:"sso_api_token_session_timeout"`
53+
ACSConsumerURL types.String `tfsdk:"acs_consumer_url"`
54+
MetadataURL types.String `tfsdk:"metadata_url"`
55+
Certificate types.String `tfsdk:"certificate"`
56+
PrivateKey types.String `tfsdk:"private_key"`
57+
PrivateKeyWO types.String `tfsdk:"private_key_wo"`
58+
SignatureSigningMethod types.String `tfsdk:"signature_signing_method"`
59+
SignatureDigestMethod types.String `tfsdk:"signature_digest_method"`
60+
}
61+
3762
// resourceTFESAMLSettings implements the tfe_saml_settings resource type
3863
type resourceTFESAMLSettings struct {
3964
client *tfe.Client

website/docs/r/saml_settings.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ The following arguments are supported:
4444
* `sso_api_token_session_timeout` - (Optional) Specifies the Single Sign On session timeout in seconds. Defaults to 14 days.
4545
* `certificate` - (Optional) The certificate used for request and assertion signing.
4646
* `private_key` - (Optional) The private key used for request and assertion signing.
47+
* `private_key_wo` - (Optional) The private key used for request and assertion signing, guaranteed not to be written to plan or state artifacts. One of `private_key` or `private_key_wo` must be provided.
4748
* `signature_signing_method` - (Optional) Signature Signing Method. Must be either `SHA1` or `SHA256`. Defaults to `SHA256`.
4849
* `signature_digest_method` - (Optional) Signature Digest Method. Must be either `SHA1` or `SHA256`. Defaults to `SHA256`.
4950

51+
-> **Note:** Write-Only argument `private_key_wo` is available to use in place of `private_key`. Write-Only arguments are supported in HashiCorp Terraform 1.11.0 and later. [Learn more](https://developer.hashicorp.com/terraform/language/v1.11.x/resources/ephemeral#write-only-arguments).
52+
5053
## Attributes Reference
5154

5255
* `id` - The ID of the SAML Settings. Always `saml`.

0 commit comments

Comments
 (0)