Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2/4] Deprecate api_user field in auth0_email resource #392

Merged
merged 2 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/resources/email.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Optional:

- `access_key_id` (String, Sensitive) AWS Access Key ID. Used only for AWS.
- `api_key` (String, Sensitive) API Key for your email service. Will always be encrypted in our database.
- `api_user` (String) API User for your email service.
- `api_user` (String, Deprecated) API User for your email service.
- `domain` (String) Domain name.
- `region` (String) Default region. Used only for AWS, Mailgun, and SparkPost.
- `secret_access_key` (String, Sensitive) AWS Secret Key. Will always be encrypted in our database. Used only for AWS.
Expand Down
71 changes: 43 additions & 28 deletions internal/provider/resource_auth0_email.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package provider

import (
"context"
"math"
"net/http"

"github.com/auth0/go-auth0/management"
Expand All @@ -10,6 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

"github.com/auth0/terraform-provider-auth0/internal/value"
)
Expand All @@ -31,6 +33,10 @@ func newEmail() *schema.Resource {
"name": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(
[]string{"mailgun", "mandrill", "sendgrid", "ses", "smtp", "sparkpost"},
false,
),
Description: "Name of the email provider. " +
"Options include `mailgun`, `mandrill`, `sendgrid`, `ses`, `smtp`, and `sparkpost`.",
},
Expand All @@ -54,40 +60,47 @@ func newEmail() *schema.Resource {
"api_user": {
Type: schema.TypeString,
Optional: true,
Deprecated: "This field is not accepted by the API any more so it will be removed soon.",
Description: "API User for your email service.",
},
"api_key": {
Type: schema.TypeString,
Optional: true,
Sensitive: true,
Description: "API Key for your email service. Will always be encrypted in our database.",
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringIsNotEmpty,
Sensitive: true,
Description: "API Key for your email service. Will always be encrypted in our database.",
},
"access_key_id": {
Type: schema.TypeString,
Optional: true,
Sensitive: true,
Description: "AWS Access Key ID. Used only for AWS.",
Type: schema.TypeString,
Optional: true,
Sensitive: true,
ValidateFunc: validation.StringIsNotEmpty,
Description: "AWS Access Key ID. Used only for AWS.",
},
"secret_access_key": {
Type: schema.TypeString,
Optional: true,
Sensitive: true,
Description: "AWS Secret Key. Will always be encrypted in our database. Used only for AWS.",
Type: schema.TypeString,
Optional: true,
Sensitive: true,
ValidateFunc: validation.StringIsNotEmpty,
Description: "AWS Secret Key. Will always be encrypted in our database. Used only for AWS.",
},
"region": {
Type: schema.TypeString,
Optional: true,
Description: "Default region. Used only for AWS, Mailgun, and SparkPost.",
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringIsNotEmpty,
Description: "Default region. Used only for AWS, Mailgun, and SparkPost.",
},
"domain": {
Type: schema.TypeString,
Optional: true,
Description: "Domain name.",
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringLenBetween(4, math.MaxInt),
Description: "Domain name.",
},
"smtp_host": {
Type: schema.TypeString,
Optional: true,
Description: "Hostname or IP address of your SMTP server. Used only for SMTP.",
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringIsNotEmpty,
Description: "Hostname or IP address of your SMTP server. Used only for SMTP.",
},
"smtp_port": {
Type: schema.TypeInt,
Expand All @@ -96,15 +109,17 @@ func newEmail() *schema.Resource {
"possible because many providers have limitations on this port. Used only for SMTP.",
},
"smtp_user": {
Type: schema.TypeString,
Optional: true,
Description: "SMTP username. Used only for SMTP.",
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringIsNotEmpty,
Description: "SMTP username. Used only for SMTP.",
},
"smtp_pass": {
Type: schema.TypeString,
Optional: true,
Sensitive: true,
Description: "SMTP password. Used only for SMTP.",
Type: schema.TypeString,
Optional: true,
Sensitive: true,
ValidateFunc: validation.StringIsNotEmpty,
Description: "SMTP password. Used only for SMTP.",
},
},
},
Expand Down