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

Create azure App Service Plan resource #1

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c18c97f
Adding azure app service plan resource
leostolyarov Jun 11, 2017
6931156
Adding azure app service resource
leostolyarov Jun 11, 2017
aa8e57d
adding dependecies with govendor and import_arm_app_service_plan_test…
leostolyarov Jun 12, 2017
91bdb76
fixing problem in the acc test
leostolyarov Jun 12, 2017
1d1ee68
fixing problem in the acc test
leostolyarov Jun 12, 2017
0ad87a0
making requested changes
leostolyarov Jun 24, 2017
e55c8c4
updating acceptance tests
leostolyarov Jun 24, 2017
cca720a
adding documentation
leostolyarov Jun 24, 2017
0688b50
changing app service plan test to use sku size S1
leostolyarov Jul 18, 2017
67d09ef
adding a polling function to check if the resource has been created
leostolyarov Jul 19, 2017
1a3ce8c
adding more tests
leostolyarov Aug 19, 2017
0b3e8f4
updating documentation
leostolyarov Aug 19, 2017
ed38a53
adding importer
leostolyarov Aug 19, 2017
622827d
adding some tests
leostolyarov Aug 19, 2017
c55f596
updating tests to use testLocation()
leostolyarov Aug 19, 2017
8cfe8dd
removing app service code
leostolyarov Aug 19, 2017
7fb0b14
formatting and removing old comments
leostolyarov Aug 19, 2017
d0b36e9
some more formatting
leostolyarov Aug 19, 2017
537b731
updating app service plan code
leostolyarov Aug 19, 2017
d16409c
removing appserviceplan.go
leostolyarov Aug 19, 2017
ffa6a44
updating app service plan tests
leostolyarov Aug 19, 2017
81fc048
updating app service plan documentation
leostolyarov Aug 19, 2017
8a11aeb
setting tags
leostolyarov Aug 19, 2017
999aec3
Upgrading to v10.3-beta of the Azure SDK
tombuildsstuff Aug 21, 2017
8a2759c
Refactoring the App Service Plan properties to match the API
tombuildsstuff Aug 21, 2017
1419459
Removing an unnecessary poll
tombuildsstuff Aug 21, 2017
742c6b9
setting the properties list correctly & updating test values
tombuildsstuff Aug 22, 2017
16e3145
Properties should be Computed
tombuildsstuff Aug 22, 2017
561d4d0
Refactorng
tombuildsstuff Aug 23, 2017
2c0f1f1
Linting
tombuildsstuff Aug 25, 2017
bc347ee
Making the Sku set a list / making the capacity configurable
tombuildsstuff Aug 25, 2017
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
17 changes: 17 additions & 0 deletions azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/Azure/azure-sdk-for-go/arm/sql"
"github.com/Azure/azure-sdk-for-go/arm/storage"
"github.com/Azure/azure-sdk-for-go/arm/trafficmanager"
"github.com/Azure/azure-sdk-for-go/arm/web"
keyVault "github.com/Azure/azure-sdk-for-go/dataplane/keyvault"
mainStorage "github.com/Azure/azure-sdk-for-go/storage"
"github.com/Azure/go-autorest/autorest"
Expand Down Expand Up @@ -119,9 +120,13 @@ type ArmClient struct {
sqlElasticPoolsClient sql.ElasticPoolsClient
sqlServersClient sql.ServersClient

appServicePlansClient web.AppServicePlansClient

appInsightsClient appinsights.ComponentsClient

servicePrincipalsClient graphrbac.ServicePrincipalsClient

appsClient web.AppsClient
}

func withRequestLogging() autorest.SendDecorator {
Expand Down Expand Up @@ -549,6 +554,12 @@ func (c *Config) getArmClient() (*ArmClient, error) {
sqlsrv.Sender = autorest.CreateSender(withRequestLogging())
client.sqlServersClient = sqlsrv

aspc := web.NewAppServicePlansClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&aspc.Client)
aspc.Authorizer = auth
aspc.Sender = autorest.CreateSender(withRequestLogging())
client.appServicePlansClient = aspc

ai := appinsights.NewComponentsClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&ai.Client)
ai.Authorizer = auth
Expand All @@ -561,6 +572,12 @@ func (c *Config) getArmClient() (*ArmClient, error) {
spc.Sender = autorest.CreateSender(withRequestLogging())
client.servicePrincipalsClient = spc

ac := web.NewAppsClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&ac.Client)
ac.Authorizer = auth
ac.Sender = autorest.CreateSender(withRequestLogging())
client.appsClient = ac

kvc := keyvault.NewVaultsClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&kvc.Client)
kvc.Authorizer = auth
Expand Down
100 changes: 100 additions & 0 deletions azurerm/import_arm_app_service_plan_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package azurerm

import (
"testing"

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

func TestAccAzureRMAppServicePlan_importBasic(t *testing.T) {
resourceName := "azurerm_app_service_plan.test"

ri := acctest.RandInt()
config := testAccAzureRMAppServicePlan_basic(ri, testLocation())

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

func TestAccAzureRMAppServicePlan_importStandard(t *testing.T) {
resourceName := "azurerm_app_service_plan.test"

ri := acctest.RandInt()
config := testAccAzureRMAppServicePlan_standard(ri, testLocation())

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

func TestAccAzureRMAppServicePlan_importPremium(t *testing.T) {
resourceName := "azurerm_app_service_plan.test"

ri := acctest.RandInt()
config := testAccAzureRMAppServicePlan_premium(ri, testLocation())

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

func TestAccAzureRMAppServicePlan_importComplete(t *testing.T) {
resourceName := "azurerm_app_service_plan.test"

ri := acctest.RandInt()
config := testAccAzureRMAppServicePlan_complete(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMAppServicePlanDestroy,
Steps: []resource.TestStep{
{
Config: config,
},
{
ResourceName: resourceName,
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 @@ -139,6 +139,8 @@ func Provider() terraform.ResourceProvider {
"azurerm_virtual_network": resourceArmVirtualNetwork(),
"azurerm_virtual_network_peering": resourceArmVirtualNetworkPeering(),

"azurerm_app_service_plan": resourceArmAppServicePlan(),

// These resources use the Riviera SDK
"azurerm_resource_group": resourceArmResourceGroup(),
"azurerm_search_service": resourceArmSearchService(),
Expand Down
Loading