Skip to content

Commit 33c4d54

Browse files
authored
fix region name for volume resource (#122)
1 parent 21b456a commit 33c4d54

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cloud/resource_volume.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ package cloud
33
import (
44
"context"
55
"fmt"
6+
"time"
7+
68
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
79
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
810
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
911
"github.com/streamnative/cloud-api-server/pkg/apis/cloud"
1012
"github.com/streamnative/cloud-api-server/pkg/apis/cloud/v1alpha1"
1113
apierrors "k8s.io/apimachinery/pkg/api/errors"
1214
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
13-
"time"
1415
)
1516

1617
func resourceVolume() *schema.Resource {
@@ -90,6 +91,7 @@ func resourceVolumeCreate(ctx context.Context, d *schema.ResourceData, meta inte
9091
Spec: v1alpha1.VolumeSpec{
9192
Bucket: bucket,
9293
Path: path,
94+
Region: region,
9395
Type: "aws",
9496
AWS: &v1alpha1.AWSSpec{
9597
RoleArn: roleArn,
@@ -184,7 +186,7 @@ func resourceVolumeRead(ctx context.Context, d *schema.ResourceData, meta interf
184186
if err = d.Set("path", volume.Spec.Path); err != nil {
185187
return diag.FromErr(fmt.Errorf("ERROR_SET_PATH: %w", err))
186188
}
187-
if err = d.Set("region", volume.Spec.AWS.Region); err != nil {
189+
if err = d.Set("region", volume.Spec.Region); err != nil {
188190
return diag.FromErr(fmt.Errorf("ERROR_SET_REGION: %w", err))
189191
}
190192
if err = d.Set("role_arn", volume.Spec.AWS.RoleArn); err != nil {
@@ -225,6 +227,7 @@ func resourceVolumeUpdate(ctx context.Context, d *schema.ResourceData, meta inte
225227
}
226228
volume.Spec.Bucket = bucket
227229
volume.Spec.Path = path
230+
volume.Spec.Region = region
228231
volume.Spec.AWS.Region = region
229232
volume.Spec.AWS.RoleArn = roleArn
230233
_, err = clientSet.CloudV1alpha1().Volumes(namespace).Update(ctx, volume, metav1.UpdateOptions{})

0 commit comments

Comments
 (0)