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

azurerm_logic_app_integration_account - support integration_service_environment_id #14015

Merged
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 @@ -59,6 +59,13 @@ func resourceLogicAppIntegrationAccount() *pluginsdk.Resource {
}, false),
},

"integration_service_environment_id": {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validate.IntegrationServiceEnvironmentID,
},

"tags": tags.Schema(),
},
}
Expand Down Expand Up @@ -93,6 +100,12 @@ func resourceLogicAppIntegrationAccountCreateUpdate(d *pluginsdk.ResourceData, m
Tags: tags.Expand(d.Get("tags").(map[string]interface{})),
}

if v, ok := d.GetOk("integration_service_environment_id"); ok {
account.IntegrationAccountProperties.IntegrationServiceEnvironment = &logic.ResourceReference{
ID: utils.String(v.(string)),
}
}

if _, err := client.CreateOrUpdate(ctx, resourceGroup, name, account); err != nil {
return fmt.Errorf("creating Integration Account %q (Resource Group %q): %+v", name, resourceGroup, err)
}
Expand Down Expand Up @@ -130,6 +143,14 @@ func resourceLogicAppIntegrationAccountRead(d *pluginsdk.ResourceData, meta inte
d.Set("location", location.NormalizeNilable(resp.Location))
d.Set("sku_name", string(resp.Sku.Name))

if props := resp.IntegrationAccountProperties; props != nil {
iseId := ""
if props.IntegrationServiceEnvironment != nil && props.IntegrationServiceEnvironment.ID != nil {
iseId = *props.IntegrationServiceEnvironment.ID
}
d.Set("integration_service_environment_id", iseId)
}

return tags.FlattenAndSet(d, resp.Tags)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ func TestAccLogicAppIntegrationAccount_update(t *testing.T) {
})
}

func TestAccLogicAppIntegrationAccount_integrationServiceEnvironment(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_logic_app_integration_account", "test")
r := LogicAppIntegrationAccountResource{}

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

func (LogicAppIntegrationAccountResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := parse.IntegrationAccountID(state.ID)
if err != nil {
Expand Down Expand Up @@ -180,3 +195,17 @@ resource "azurerm_logic_app_integration_account" "test" {
}
`, r.template(data), data.RandomInteger)
}

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

resource "azurerm_logic_app_integration_account" "test" {
name = "acctest-IA-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku_name = "Standard"
integration_service_environment_id = azurerm_integration_service_environment.test.id
}
`, IntegrationServiceEnvironmentResource{}.basic(data), data.RandomInteger)
}
2 changes: 2 additions & 0 deletions website/docs/r/logic_app_integration_account.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ The following arguments are supported:

---

* `integration_service_environment_id` - (Optional) The resource ID of the Integration Service Environment. Changing this forces a new Logic App Integration Account to be created.

* `tags` - (Optional) A mapping of tags which should be assigned to the Logic App Integration Account.

## Attributes Reference
Expand Down