-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add self_managed_certificate_nonsensitive
Signed-off-by: Andy Lo-A-Foe <andy.loafoe@gmail.com>
- Loading branch information
Showing
3 changed files
with
132 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,9 @@ The following arguments are supported: | |
* `self_managed_expires_on` - (Deprecated, Optional) Sets the certificate validity. When not specified, the certificate will have a validity of 5 years. | ||
* `self_managed_certificate` - (Optional) X509 Certificate in PEM format. When provided, overrides the generated certificate / private key combination of the IAM service. | ||
This gives you full control over the credentials. When not specified, a private key will be generated by IAM. Mutually exclusive with `self_managed_private_key` | ||
* `self_managed_certificate_nonsensitive` - (Optional) X509 Certificate in PEM format. When provided, overrides the generated certificate / private key combination of the IAM service. | ||
This gives you full control over the credentials. When not specified, a private key will be generated by IAM. Mutually exclusive with `self_managed_private_key` | ||
|
||
|
||
Check failure on line 86 in docs/resources/iam_service.md GitHub Actions / markdownlintMultiple consecutive blank lines
Check failure on line 86 in docs/resources/iam_service.md GitHub Actions / markdownlintMultiple consecutive blank lines
|
||
## Attributes Reference | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package service | ||
|
||
import ( | ||
"context" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" | ||
"github.com/philips-software/terraform-provider-hsdp/internal/tools" | ||
) | ||
|
||
// Upgrades an IAM Service resource from v4 to v5 | ||
func patchIAMServiceV5(_ context.Context, rawState map[string]interface{}, _ interface{}) (map[string]interface{}, error) { | ||
if rawState == nil { | ||
rawState = map[string]interface{}{} | ||
} | ||
return rawState, nil | ||
} | ||
|
||
func ResourceIAMServiceV5() *schema.Resource { | ||
return &schema.Resource{ | ||
// This is only used for state migration, so the CRUD | ||
// callbacks are no longer relevant | ||
Schema: map[string]*schema.Schema{ | ||
"name": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
DiffSuppressFunc: tools.SuppressCaseDiffs, | ||
}, | ||
"description": { | ||
Type: schema.TypeString, | ||
ForceNew: true, | ||
Required: true, | ||
}, | ||
"application_id": { | ||
Type: schema.TypeString, | ||
ForceNew: true, | ||
Required: true, | ||
}, | ||
"validity": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Default: 12, | ||
ForceNew: true, | ||
ValidateFunc: validation.IntBetween(1, 600), | ||
}, | ||
"token_validity": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Default: 1800, | ||
ValidateFunc: validation.IntBetween(0, 2592000), | ||
}, | ||
"self_managed_private_key": { | ||
Type: schema.TypeString, | ||
Sensitive: true, | ||
Optional: true, | ||
}, | ||
"self_managed_certificate": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Deprecated: "Use 'self_managed_private_key' instead. This will be removed in a future version", | ||
}, | ||
"private_key": { | ||
Type: schema.TypeString, | ||
Sensitive: true, | ||
Computed: true, | ||
}, | ||
"service_id": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
"organization_id": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
"expires_on": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Computed: true, | ||
DiffSuppressFunc: tools.SuppressWhenGenerated, | ||
}, | ||
"scopes": { | ||
Type: schema.TypeSet, | ||
MaxItems: 100, | ||
MinItems: 1, // openid | ||
Required: true, | ||
Elem: &schema.Schema{Type: schema.TypeString}, | ||
}, | ||
"default_scopes": { | ||
Type: schema.TypeSet, | ||
MaxItems: 100, | ||
MinItems: 1, // openid | ||
Required: true, | ||
Elem: &schema.Schema{Type: schema.TypeString}, | ||
}, | ||
}, | ||
} | ||
} |