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

New Resource: azurerm_recovery_services_protection_policy_vm #1978

Merged
merged 7 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 7 additions & 1 deletion azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
"github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2018-03-01-preview/management"
"github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/2017-08-01-preview/security"
"github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql"
"github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2016-06-01/backup"
"github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2016-06-01/recoveryservices"
"github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis"
"github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay"
Expand Down Expand Up @@ -242,7 +243,8 @@ type ArmClient struct {
notificationNamespacesClient notificationhubs.NamespacesClient

// Recovery Services
recoveryServicesVaultsClient recoveryservices.VaultsClient
recoveryServicesVaultsClient recoveryservices.VaultsClient
recoveryServicesProtectionPoliciesClient backup.ProtectionPoliciesClient

// Relay
relayNamespacesClient relay.NamespacesClient
Expand Down Expand Up @@ -999,6 +1001,10 @@ func (c *ArmClient) registerRecoveryServiceClients(endpoint, subscriptionId stri
vaultsClient := recoveryservices.NewVaultsClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&vaultsClient.Client, auth)
c.recoveryServicesVaultsClient = vaultsClient

protectionPoliciesClient := backup.NewProtectionPoliciesClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&protectionPoliciesClient.Client, auth)
c.recoveryServicesProtectionPoliciesClient = protectionPoliciesClient
}

func (c *ArmClient) registerRedisClients(endpoint, subscriptionId string, auth autorest.Authorizer, sender autorest.Sender) {
Expand Down
30 changes: 30 additions & 0 deletions azurerm/helpers/validate/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/Azure/go-autorest/autorest/date"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
)

//todo, now in terraform helper, switch over once vended
Expand Down Expand Up @@ -46,3 +47,32 @@ func RFC3339DateInFutureBy(d time.Duration) schema.SchemaValidateFunc {
return
}
}

func DayOfTheWeek(ignoreCase bool) schema.SchemaValidateFunc {
Copy link
Contributor

@paultyng paultyng Oct 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should probably have unit testing? Maybe they are too simplistic, not sure.

return validation.StringInSlice([]string{
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday",
}, ignoreCase)
}

func Month(ignoreCase bool) schema.SchemaValidateFunc {
return validation.StringInSlice([]string{
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
}, ignoreCase)
}
4 changes: 2 additions & 2 deletions azurerm/resource_arm_automation_schedule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ resource "azurerm_automation_schedule" "test" {

func checkAccAzureRMAutomationSchedule_oneTime_basic(resourceName string) resource.TestCheckFunc {
return resource.ComposeAggregateTestCheckFunc(
testCheckAzureRMAutomationScheduleExists("azurerm_automation_schedule.test"),
testCheckAzureRMAutomationScheduleExists(resourceName),
resource.TestCheckResourceAttrSet(resourceName, "name"),
resource.TestCheckResourceAttrSet(resourceName, "resource_group_name"),
resource.TestCheckResourceAttrSet(resourceName, "automation_account_name"),
Expand Down Expand Up @@ -395,7 +395,7 @@ resource "azurerm_automation_schedule" "test" {

func checkAccAzureRMAutomationSchedule_recurring_basic(resourceName string, frequency string, interval int) resource.TestCheckFunc {
return resource.ComposeAggregateTestCheckFunc(
testCheckAzureRMAutomationScheduleExists("azurerm_automation_schedule.test"),
testCheckAzureRMAutomationScheduleExists(resourceName),
resource.TestCheckResourceAttrSet(resourceName, "name"),
resource.TestCheckResourceAttrSet(resourceName, "resource_group_name"),
resource.TestCheckResourceAttrSet(resourceName, "automation_account_name"),
Expand Down
Loading