Skip to content

Commit

Permalink
New Resource: azurerm_logic_app_workflow
Browse files Browse the repository at this point in the history
Tests pass:

```
$ acctests azurerm TestAccAzureRMLogicAppWorkflow_
=== RUN   TestAccAzureRMLogicAppWorkflow_empty
--- PASS: TestAccAzureRMLogicAppWorkflow_empty (97.38s)
=== RUN   TestAccAzureRMLogicAppWorkflow_tags
--- PASS: TestAccAzureRMLogicAppWorkflow_tags (83.56s)
=== RUN   TestAccAzureRMLogicAppWorkflow_actionHTTP
--- PASS: TestAccAzureRMLogicAppWorkflow_actionHTTP (75.25s)
PASS
ok      github.com/terraform-providers/terraform-provider-azurerm/azurerm       256.212s
```

Fixes #610
  • Loading branch information
tombuildsstuff committed May 21, 2018
1 parent 753a51a commit b5f3b03
Show file tree
Hide file tree
Showing 7 changed files with 874 additions and 1 deletion.
11 changes: 11 additions & 0 deletions azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-07-01/devices"
keyVault "github.com/Azure/azure-sdk-for-go/services/keyvault/2016-10-01/keyvault"
"github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault"
"github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2016-06-01/logic"
"github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights"
"github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
Expand Down Expand Up @@ -142,6 +143,9 @@ type ArmClient struct {
keyVaultClient keyvault.VaultsClient
keyVaultManagementClient keyVault.BaseClient

// Logic
logicWorkflowsClient logic.WorkflowsClient

// Monitor
monitorAlertRulesClient insights.AlertRulesClient

Expand Down Expand Up @@ -379,6 +383,7 @@ func getArmClient(c *authentication.Config) (*ArmClient, error) {
client.registerEventGridClients(endpoint, c.SubscriptionID, auth, sender)
client.registerEventHubClients(endpoint, c.SubscriptionID, auth, sender)
client.registerKeyVaultClients(endpoint, c.SubscriptionID, auth, keyVaultAuth, sender)
client.registerLogicClients(endpoint, c.SubscriptionID, auth, sender)
client.registerMonitorClients(endpoint, c.SubscriptionID, auth, sender)
client.registerNetworkingClients(endpoint, c.SubscriptionID, auth, sender)
client.registerOperationalInsightsClients(endpoint, c.SubscriptionID, auth, sender)
Expand Down Expand Up @@ -697,6 +702,12 @@ func (c *ArmClient) registerKeyVaultClients(endpoint, subscriptionId string, aut
c.keyVaultManagementClient = keyVaultManagementClient
}

func (c *ArmClient) registerLogicClients(endpoint, subscriptionId string, auth autorest.Authorizer, sender autorest.Sender) {
workflowsClient := logic.NewWorkflowsClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&workflowsClient.Client, auth)
c.logicWorkflowsClient = workflowsClient
}

func (c *ArmClient) registerMonitorClients(endpoint, subscriptionId string, auth autorest.Authorizer, sender autorest.Sender) {
arc := insights.NewAlertRulesClientWithBaseURI(endpoint, subscriptionId)
setUserAgent(&arc.Client)
Expand Down
71 changes: 71 additions & 0 deletions azurerm/import_arm_logic_app_workspace_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package azurerm

import (
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccAzureRMLogicAppWorkspace_importEmpty(t *testing.T) {
ri := acctest.RandInt()
config := testAccAzureRMLogicAppWorkflow_empty(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMLogicAppWorklowDestroy,
Steps: []resource.TestStep{
{
Config: config,
},
{
ResourceName: "azurerm_logic_app_workspace.test",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAzureRMLogicAppWorkspace_importTags(t *testing.T) {
ri := acctest.RandInt()
config := testAccAzureRMLogicAppWorkflow_tags(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMLogicAppWorklowDestroy,
Steps: []resource.TestStep{
{
Config: config,
},
{
ResourceName: "azurerm_logic_app_workspace.test",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAzureRMLogicAppWorkspace_importActionHTTP(t *testing.T) {
ri := acctest.RandInt()
config := testAccAzureRMLogicAppWorkflow_actionHTTP(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMLogicAppWorklowDestroy,
Steps: []resource.TestStep{
{
Config: config,
},
{
ResourceName: "azurerm_logic_app_workspace.test",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
2 changes: 2 additions & 0 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_local_network_gateway": resourceArmLocalNetworkGateway(),
"azurerm_log_analytics_solution": resourceArmLogAnalyticsSolution(),
"azurerm_log_analytics_workspace": resourceArmLogAnalyticsWorkspace(),
"azurerm_logic_app_workflow": resourceArmLogicAppWorkflow(),
"azurerm_managed_disk": resourceArmManagedDisk(),
"azurerm_management_lock": resourceArmManagementLock(),
"azurerm_metric_alertrule": resourceArmMetricAlertRule(),
Expand Down Expand Up @@ -341,6 +342,7 @@ func determineAzureResourceProvidersToRegister(providerList []resources.Provider
"Microsoft.EventHub": {},
"Microsoft.KeyVault": {},
"microsoft.insights": {},
"Microsoft.Logic": {},
"Microsoft.Network": {},
"Microsoft.OperationalInsights": {},
"Microsoft.Relay": {},
Expand Down
Loading

0 comments on commit b5f3b03

Please sign in to comment.