@@ -42,9 +42,9 @@ func (m GenericMount) getBlock() Mount {
4242}
4343
4444// Source returns URI backing the mount
45- func (m GenericMount ) Source () string {
45+ func (m GenericMount ) Source (client * common. DatabricksClient ) string {
4646 if block := m .getBlock (); block != nil {
47- return block .Source ()
47+ return block .Source (client )
4848 }
4949 return m .URI
5050}
@@ -96,7 +96,7 @@ func parseStorageContainerId(rid string) (string, string, error) {
9696 return match [3 ], match [4 ], nil
9797}
9898
99- func getContainerDefaults (d * schema.ResourceData , allowed_schemas [] string , suffix string ) (string , string , error ) {
99+ func getContainerDefaults (d * schema.ResourceData ) (string , string , error ) {
100100 rid := d .Get ("resource_id" ).(string )
101101 if rid != "" {
102102 acc , cont , err := parseStorageContainerId (rid )
@@ -134,9 +134,8 @@ type AzureADLSGen2MountGeneric struct {
134134}
135135
136136// Source returns ABFSS URI backing the mount
137- func (m * AzureADLSGen2MountGeneric ) Source () string {
138- return fmt .Sprintf ("abfss://%s@%s.dfs.core.windows.net%s" ,
139- m .ContainerName , m .StorageAccountName , m .Directory )
137+ func (m * AzureADLSGen2MountGeneric ) Source (client * common.DatabricksClient ) string {
138+ return fmt .Sprintf ("abfss://%s@%s.dfs.%s%s" , m .ContainerName , m .StorageAccountName , getAzureDomain (client ), m .Directory )
140139}
141140
142141func (m * AzureADLSGen2MountGeneric ) Name () string {
@@ -145,7 +144,7 @@ func (m *AzureADLSGen2MountGeneric) Name() string {
145144
146145func (m * AzureADLSGen2MountGeneric ) ValidateAndApplyDefaults (d * schema.ResourceData , client * common.DatabricksClient ) error {
147146 if m .ContainerName == "" || m .StorageAccountName == "" {
148- acc , cont , err := getContainerDefaults (d , [] string { "abfs" , "abfss" }, "dfs.core.windows.net" )
147+ acc , cont , err := getContainerDefaults (d )
149148 if err != nil {
150149 return err
151150 }
@@ -194,7 +193,7 @@ type AzureADLSGen1MountGeneric struct {
194193}
195194
196195// Source ...
197- func (m * AzureADLSGen1MountGeneric ) Source () string {
196+ func (m * AzureADLSGen1MountGeneric ) Source (_ * common. DatabricksClient ) string {
198197 return fmt .Sprintf ("adl://%s.azuredatalakestore.net%s" , m .StorageResource , m .Directory )
199198}
200199
@@ -237,10 +236,9 @@ func (m *AzureADLSGen1MountGeneric) Config(client *common.DatabricksClient) map[
237236 aadEndpoint := client .Config .Environment ().AzureActiveDirectoryEndpoint ()
238237 return map [string ]string {
239238 m .PrefixType + ".oauth2.access.token.provider.type" : "ClientCredential" ,
240-
241- m .PrefixType + ".oauth2.client.id" : m .ClientID ,
242- m .PrefixType + ".oauth2.credential" : fmt .Sprintf ("{{secrets/%s/%s}}" , m .SecretScope , m .SecretKey ),
243- m .PrefixType + ".oauth2.refresh.url" : fmt .Sprintf ("%s%s/oauth2/token" , aadEndpoint , m .TenantID ),
239+ m .PrefixType + ".oauth2.client.id" : m .ClientID ,
240+ m .PrefixType + ".oauth2.credential" : fmt .Sprintf ("{{secrets/%s/%s}}" , m .SecretScope , m .SecretKey ),
241+ m .PrefixType + ".oauth2.refresh.url" : fmt .Sprintf ("%s%s/oauth2/token" , aadEndpoint , m .TenantID ),
244242 }
245243}
246244
@@ -257,9 +255,9 @@ type AzureBlobMountGeneric struct {
257255}
258256
259257// Source ...
260- func (m * AzureBlobMountGeneric ) Source () string {
261- return fmt .Sprintf ("wasbs://%[1]s@%[2]s.blob.core.windows.net %[3]s" ,
262- m .ContainerName , m .StorageAccountName , m .Directory )
258+ func (m * AzureBlobMountGeneric ) Source (client * common. DatabricksClient ) string {
259+ return fmt .Sprintf ("wasbs://%[1]s@%[2]s.blob.%[3]s%[4 ]s" ,
260+ m .ContainerName , m .StorageAccountName , getAzureDomain ( client ), m .Directory )
263261}
264262
265263func (m * AzureBlobMountGeneric ) Name () string {
@@ -268,7 +266,7 @@ func (m *AzureBlobMountGeneric) Name() string {
268266
269267func (m * AzureBlobMountGeneric ) ValidateAndApplyDefaults (d * schema.ResourceData , client * common.DatabricksClient ) error {
270268 if m .ContainerName == "" || m .StorageAccountName == "" {
271- acc , cont , err := getContainerDefaults (d , [] string { "wasb" , "wasbs" }, "blob.core.windows.net" )
269+ acc , cont , err := getContainerDefaults (d )
272270 if err != nil {
273271 return err
274272 }
0 commit comments