Skip to content

Commit

Permalink
Allow storage_class_name to be ""
Browse files Browse the repository at this point in the history
  • Loading branch information
lawliet89 committed Aug 13, 2019
1 parent 822d092 commit 0cfc18a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions kubernetes/structure_persistent_volume_claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"errors"

"github.com/hashicorp/terraform/helper/schema"
"k8s.io/api/core/v1"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
)

// Flatteners
Expand Down Expand Up @@ -79,7 +79,7 @@ func expandPersistentVolumeClaimSpec(l []interface{}) (*v1.PersistentVolumeClaim
if v, ok := in["volume_name"].(string); ok {
obj.VolumeName = v
}
if v, ok := in["storage_class_name"].(string); ok && v != "" {
if v, ok := in["storage_class_name"].(string); ok {
obj.StorageClassName = ptrToString(v)
}
return obj, nil
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/structure_persistent_volume_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func flattenPersistentVolumeSpec(in v1.PersistentVolumeSpec) []interface{} {
if in.PersistentVolumeReclaimPolicy != "" {
att["persistent_volume_reclaim_policy"] = in.PersistentVolumeReclaimPolicy
}
if in.StorageClassName != "" {
if in.StorageClassName != nil {
att["storage_class_name"] = in.StorageClassName
}
if in.NodeAffinity != nil {
Expand Down

0 comments on commit 0cfc18a

Please sign in to comment.