Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data plane: fixing a regression where endpoint was used rather than domainSuffix #20536

Merged
merged 2 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions internal/services/logic/logic_app_standard_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,10 @@ func resourceLogicAppStandardCreate(d *pluginsdk.ResourceData, meta interface{})
ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d)
defer cancel()

storageEndpointSuffix, ok := meta.(*clients.Client).Account.Environment.Storage.Endpoint()
env := meta.(*clients.Client).Account.Environment
storageAccountDomainSuffix, ok := env.Storage.DomainSuffix()
if !ok {
return fmt.Errorf("could not determine storage endpoint suffix for environment %q", meta.(*clients.Client).Account.Environment.Name)
return fmt.Errorf("could not determine the domain suffix for storage accounts in environment %q: %+v", env.Name, env.Storage)
}

log.Printf("[INFO] preparing arguments for AzureRM Logic App Standard creation.")
Expand Down Expand Up @@ -286,7 +287,7 @@ func resourceLogicAppStandardCreate(d *pluginsdk.ResourceData, meta interface{})
VirtualNetworkSubnetID := d.Get("virtual_network_subnet_id").(string)
t := d.Get("tags").(map[string]interface{})

basicAppSettings, err := getBasicLogicAppSettings(d, *storageEndpointSuffix)
basicAppSettings, err := getBasicLogicAppSettings(d, *storageAccountDomainSuffix)
if err != nil {
return err
}
Expand Down Expand Up @@ -356,9 +357,10 @@ func resourceLogicAppStandardUpdate(d *pluginsdk.ResourceData, meta interface{})
ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d)
defer cancel()

storageEndpointSuffix, ok := meta.(*clients.Client).Account.Environment.Storage.Endpoint()
env := meta.(*clients.Client).Account.Environment
storageAccountDomainSuffix, ok := env.Storage.DomainSuffix()
if !ok {
return fmt.Errorf("could not determine storage endpoint suffix for environment %q", meta.(*clients.Client).Account.Environment.Name)
return fmt.Errorf("could not determine the domain suffix for storage accounts in environment %q: %+v", env.Name, env.Storage)
}

id, err := parse.LogicAppStandardID(d.Id())
Expand All @@ -375,7 +377,7 @@ func resourceLogicAppStandardUpdate(d *pluginsdk.ResourceData, meta interface{})
httpsOnly := d.Get("https_only").(bool)
t := d.Get("tags").(map[string]interface{})

basicAppSettings, err := getBasicLogicAppSettings(d, *storageEndpointSuffix)
basicAppSettings, err := getBasicLogicAppSettings(d, *storageAccountDomainSuffix)
if err != nil {
return err
}
Expand All @@ -393,7 +395,7 @@ func resourceLogicAppStandardUpdate(d *pluginsdk.ResourceData, meta interface{})
siteConfig.AppSettings = &basicAppSettings

// WEBSITE_VNET_ROUTE_ALL is superseded by a setting in site_config that defaults to false from 2021-02-01
appSettings, err := expandLogicAppStandardSettings(d, *storageEndpointSuffix)
appSettings, err := expandLogicAppStandardSettings(d, *storageAccountDomainSuffix)
if err != nil {
return fmt.Errorf("expanding `app_settings`: %+v", err)
}
Expand Down
23 changes: 12 additions & 11 deletions internal/services/synapse/synapse_role_assignment_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ func resourceSynapseRoleAssignmentCreate(d *pluginsdk.ResourceData, meta interfa
synapseClient := meta.(*clients.Client).Synapse
ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d)
defer cancel()
environment := meta.(*clients.Client).Account.Environment
synapseDomainSuffix, ok := environment.Synapse.DomainSuffix()
env := meta.(*clients.Client).Account.Environment
synapseDomainSuffix, ok := env.Synapse.DomainSuffix()
if !ok {
return fmt.Errorf("could not determine Synapse domain suffix for environment %q", environment.Name)
return fmt.Errorf("could not determine the domain suffix for synapse in environment %q: %+v", env.Name, env.Storage)
}

synapseScope := ""
Expand Down Expand Up @@ -180,10 +180,11 @@ func resourceSynapseRoleAssignmentRead(d *pluginsdk.ResourceData, meta interface
synapseClient := meta.(*clients.Client).Synapse
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()
environment := meta.(*clients.Client).Account.Environment
synapseEndpointSuffix, ok := environment.Synapse.Endpoint()

env := meta.(*clients.Client).Account.Environment
synapseDomainSuffix, ok := env.Synapse.DomainSuffix()
if !ok {
return fmt.Errorf("could not determine synapse endpoint suffix for environment %q", environment.Name)
return fmt.Errorf("could not determine the domain suffix for synapse in environment %q: %+v", env.Name, env.Storage)
}

id, err := parse.RoleAssignmentID(d.Id())
Expand All @@ -196,11 +197,11 @@ func resourceSynapseRoleAssignmentRead(d *pluginsdk.ResourceData, meta interface
return err
}

client, err := synapseClient.RoleAssignmentsClient(workspaceName, *synapseEndpointSuffix)
client, err := synapseClient.RoleAssignmentsClient(workspaceName, *synapseDomainSuffix)
if err != nil {
return err
}
roleDefinitionsClient, err := synapseClient.RoleDefinitionsClient(workspaceName, *synapseEndpointSuffix)
roleDefinitionsClient, err := synapseClient.RoleDefinitionsClient(workspaceName, *synapseDomainSuffix)
if err != nil {
return err
}
Expand Down Expand Up @@ -246,10 +247,10 @@ func resourceSynapseRoleAssignmentDelete(d *pluginsdk.ResourceData, meta interfa
synapseClient := meta.(*clients.Client).Synapse
ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d)
defer cancel()
environment := meta.(*clients.Client).Account.Environment
synapseDomainSuffix, ok := environment.Synapse.DomainSuffix()
env := meta.(*clients.Client).Account.Environment
synapseDomainSuffix, ok := env.Synapse.DomainSuffix()
if !ok {
return fmt.Errorf("could not determine Synapse domain suffix for environment %q", environment.Name)
return fmt.Errorf("could not determine the domain suffix for synapse in environment %q: %+v", env.Name, env.Storage)
}

id, err := parse.RoleAssignmentID(d.Id())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ func (r SynapseRoleAssignmentResource) Exists(ctx context.Context, client *clien
return nil, err
}

suffix, ok := client.Account.Environment.Synapse.DomainSuffix()
env := client.Account.Environment
suffix, ok := env.Synapse.DomainSuffix()
if !ok {
return nil, fmt.Errorf("could not determine Synapse domain suffix for environment %q", client.Account.Environment.Name)
return nil, fmt.Errorf("could not determine the domain suffix for synapse in environment %q: %+v", env.Name, env.Storage)
}

roleAssignmentsClient, err := client.Synapse.RoleAssignmentsClient(workspaceName, *suffix)
Expand Down