Skip to content

Commit

Permalink
add isNotEmpty validation for some fields
Browse files Browse the repository at this point in the history
  • Loading branch information
njuCZ committed Mar 25, 2020
1 parent e42b33a commit 63a9f38
Showing 1 changed file with 36 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,22 @@ func resourceArmSpringCloudService() *schema.Resource {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
ValidateFunc: validation.StringIsNotEmpty,
},
},

"http_basic_auth": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ConflictsWith: []string{"config_server_git_settings.0.ssh_auth"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"username": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringIsNotEmpty,
},

"password": {
Expand All @@ -96,25 +99,27 @@ func resourceArmSpringCloudService() *schema.Resource {
},
},
},
ConflictsWith: []string{"config_server_git_settings.0.ssh_auth"},
},

"ssh_auth": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ConflictsWith: []string{"config_server_git_settings.0.http_basic_auth"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"private_key": {
Type: schema.TypeString,
Required: true,
Sensitive: true,
Type: schema.TypeString,
Required: true,
Sensitive: true,
ValidateFunc: validation.StringIsNotEmpty,
},

"host_key": {
Type: schema.TypeString,
Optional: true,
Sensitive: true,
Type: schema.TypeString,
Optional: true,
Sensitive: true,
ValidateFunc: validation.StringIsNotEmpty,
},

"host_key_algorithm": {
Expand All @@ -135,7 +140,6 @@ func resourceArmSpringCloudService() *schema.Resource {
},
},
},
ConflictsWith: []string{"config_server_git_settings.0.http_basic_auth"},
},

"repositories": {
Expand All @@ -161,14 +165,16 @@ func resourceArmSpringCloudService() *schema.Resource {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
ValidateFunc: validation.StringIsNotEmpty,
},
},
"search_paths": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
ValidateFunc: validation.StringIsNotEmpty,
},
},
"http_basic_auth": {
Expand All @@ -178,8 +184,9 @@ func resourceArmSpringCloudService() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"username": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringIsNotEmpty,
},

"password": {
Expand All @@ -197,15 +204,17 @@ func resourceArmSpringCloudService() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"private_key": {
Type: schema.TypeString,
Required: true,
Sensitive: true,
Type: schema.TypeString,
Required: true,
Sensitive: true,
ValidateFunc: validation.StringIsNotEmpty,
},

"host_key": {
Type: schema.TypeString,
Optional: true,
Sensitive: true,
Type: schema.TypeString,
Optional: true,
Sensitive: true,
ValidateFunc: validation.StringIsNotEmpty,
},

"host_key_algorithm": {
Expand Down

0 comments on commit 63a9f38

Please sign in to comment.