-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
New Resource: Autoscale Settings #135
Changes from 10 commits
f244167
7e3bf4c
4160f80
4558552
8e239ed
b75a5a8
aeb9404
db72912
b3d80d6
46d84fa
e8ab04e
95d0487
ce63deb
4399fb5
ca25e57
e397a55
29db256
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import ( | |
"github.com/Azure/azure-sdk-for-go/arm/containerservice" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any mistake whatsoever in the values sent to Azure causes 400 unknown with no info on where/what the problem is. Can you check with fiddler to see if that's really all we're getting, and report an error to Azure (if it is) or go sdk (if sdk is not giving us the error info). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same on portal, when something goes wrong with autoscale settings, it just says "bad request". :( |
||
"github.com/Azure/azure-sdk-for-go/arm/disk" | ||
"github.com/Azure/azure-sdk-for-go/arm/eventhub" | ||
"github.com/Azure/azure-sdk-for-go/arm/insights" | ||
"github.com/Azure/azure-sdk-for-go/arm/keyvault" | ||
"github.com/Azure/azure-sdk-for-go/arm/network" | ||
"github.com/Azure/azure-sdk-for-go/arm/redis" | ||
|
@@ -42,6 +43,8 @@ type ArmClient struct { | |
|
||
rivieraClient *riviera.Client | ||
|
||
autoscaleSettingsClient insights.AutoscaleSettingsClient | ||
|
||
availSetClient compute.AvailabilitySetsClient | ||
usageOpsClient compute.UsageClient | ||
vmExtensionImageClient compute.VirtualMachineExtensionImagesClient | ||
|
@@ -194,6 +197,12 @@ func (c *Config) getArmClient() (*ArmClient, error) { | |
|
||
// NOTE: these declarations should be left separate for clarity should the | ||
// clients be wished to be configured with custom Responders/PollingModess etc... | ||
assc := insights.NewAutoscaleSettingsClientWithBaseURI(endpoint, c.SubscriptionID) | ||
setUserAgent(&assc.Client) | ||
assc.Authorizer = auth | ||
assc.Sender = autorest.CreateSender(withRequestLogging()) | ||
client.autoscaleSettingsClient = assc | ||
|
||
asc := compute.NewAvailabilitySetsClientWithBaseURI(endpoint, c.SubscriptionID) | ||
setUserAgent(&asc.Client) | ||
asc.Authorizer = auth | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package azurerm | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/acctest" | ||
"github.com/hashicorp/terraform/helper/resource" | ||
) | ||
|
||
func TestAccAzureRMAutoscaleSetting_importBasic(t *testing.T) { | ||
resourceName := "azurerm_autoscale_setting.test" | ||
|
||
ri := acctest.RandInt() | ||
config := testAccAzureRMAutoscaleSetting_basic(ri) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testCheckAzureRMAutoscaleSettingDestroy, | ||
Steps: []resource.TestStep{ | ||
resource.TestStep{ | ||
Config: config, | ||
}, | ||
|
||
resource.TestStep{ | ||
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMAutoscaleSetting_importRecurrence(t *testing.T) { | ||
resourceName := "azurerm_autoscale_setting.test" | ||
|
||
ri := acctest.RandInt() | ||
config := testAccAzureRMAutoscaleSetting_recurrence(ri) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testCheckAzureRMAutoscaleSettingDestroy, | ||
Steps: []resource.TestStep{ | ||
resource.TestStep{ | ||
Config: config, | ||
}, | ||
|
||
resource.TestStep{ | ||
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMAutoscaleSetting_importFixedDate(t *testing.T) { | ||
resourceName := "azurerm_autoscale_setting.test" | ||
|
||
ri := acctest.RandInt() | ||
config := testAccAzureRMAutoscaleSetting_fixedDate(ri) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testCheckAzureRMAutoscaleSettingDestroy, | ||
Steps: []resource.TestStep{ | ||
resource.TestStep{ | ||
Config: config, | ||
}, | ||
|
||
resource.TestStep{ | ||
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Terraform always thinks the following template needs changes:
https://gist.github.com/StephenWeatherford/c236ae8c3f61efcbfd153b6d58f3049a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because the VMSS number of instances got changed by the auto-scaling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, does the number of instances (
capacity
) within VMSS need to be set to computed?