@@ -102,7 +102,8 @@ func readResource(
102102 defer teardownKeysCleanUp ()
103103 }
104104
105- s3Client , err := helper .S3Connection (ctx , bucket .S3Endpoint , objKeys .AccessKey , objKeys .SecretKey )
105+ endpoint := getS3Endpoint (ctx , * bucket )
106+ s3Client , err := helper .S3Connection (ctx , endpoint , objKeys .AccessKey , objKeys .SecretKey )
106107 if err != nil {
107108 return diag .FromErr (err )
108109 }
@@ -123,14 +124,16 @@ func readResource(
123124 d .SetId (fmt .Sprintf ("%s:%s" , bucket .Cluster , bucket .Label ))
124125 }
125126
127+ endpoint := getS3Endpoint (ctx , * bucket )
128+
126129 d .Set ("cluster" , bucket .Cluster )
127130 d .Set ("region" , bucket .Region )
128131 d .Set ("label" , bucket .Label )
129132 d .Set ("hostname" , bucket .Hostname )
130133 d .Set ("acl" , access .ACL )
131134 d .Set ("cors_enabled" , access .CorsEnabled )
132- d .Set ("endpoint" , bucket . S3Endpoint )
133- d .Set ("s3_endpoint" , bucket . S3Endpoint )
135+ d .Set ("endpoint" , endpoint )
136+ d .Set ("s3_endpoint" , endpoint )
134137 d .Set ("endpoint_type" , bucket .EndpointType )
135138
136139 return nil
@@ -178,8 +181,10 @@ func createResource(
178181 return diag .Errorf ("failed to create a Linode ObjectStorageBucket: %s" , err )
179182 }
180183
181- d .Set ("endpoint" , bucket .S3Endpoint )
182- d .Set ("s3_endpoint" , bucket .S3Endpoint )
184+ endpoint := getS3Endpoint (ctx , * bucket )
185+
186+ d .Set ("endpoint" , endpoint )
187+ d .Set ("s3_endpoint" , endpoint )
183188
184189 if bucket .Region != "" {
185190 d .SetId (fmt .Sprintf ("%s:%s" , bucket .Region , bucket .Label ))
0 commit comments