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

synapse_integration_runtime_azure- locations supports Auto Resolve #17111

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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/Azure/azure-sdk-for-go/services/synapse/mgmt/2021-03-01/synapse"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down Expand Up @@ -54,7 +55,17 @@ func resourceSynapseIntegrationRuntimeAzure() *pluginsdk.Resource {
ValidateFunc: validate.WorkspaceID,
},

"location": azure.SchemaLocation(),
"location": {
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.Any(
location.EnhancedValidate,
validation.StringInSlice([]string{"AutoResolve"}, false),
),
StateFunc: location.StateFunc,
DiffSuppressFunc: location.DiffSuppressFunc,
},

"compute_type": {
Type: pluginsdk.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ func TestAccSynapseIntegrationRuntimeAzure_update(t *testing.T) {
})
}

func TestAccSynapseIntegrationRuntimeAzure_autoResolve(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_synapse_integration_runtime_azure", "test")
r := IntegrationRuntimeAzureResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.autoResolve(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
})
}

func (r IntegrationRuntimeAzureResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := parse.IntegrationRuntimeID(state.ID)
if err != nil {
Expand All @@ -113,6 +127,18 @@ resource "azurerm_synapse_integration_runtime_azure" "test" {
`, r.template(data))
}

func (r IntegrationRuntimeAzureResource) autoResolve(data acceptance.TestData) string {
return fmt.Sprintf(`
%s

resource "azurerm_synapse_integration_runtime_azure" "test" {
name = "azure-integration-runtime"
synapse_workspace_id = azurerm_synapse_workspace.test.id
location = "AutoResolve"
}
`, r.template(data))
}

func (r IntegrationRuntimeAzureResource) requiresImport(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The following arguments are supported:

* `synapse_workspace_id` - (Required) The Synapse Workspace ID in which to associate the Integration Runtime with. Changing this forces a new Synapse Azure Integration Runtime to be created.

* `location` - (Required) The Azure Region where the Synapse Azure Integration Runtime should exist. Changing this forces a new Synapse Azure Integration Runtime to be created.
* `location` - (Required) The Azure Region where the Synapse Azure Integration Runtime should exist. Use `AutoResolve` to create an auto-resolve integration runtime. Changing this forces a new Synapse Azure Integration Runtime to be created.

---

Expand Down