-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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_orchestrated_virtual_machine_scale_set
#6626
Conversation
azurerm_virtual_machine_scale_set_orchestrator_vm
azurerm_orchestrated_virtual_machine_scale_set
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.
Thanks for this PR - I've taken a look through and left some comments inline, but this is off to a good start - if we can fix up the comments then we can take another look 👍
Thanks!
azurerm/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/compute/tests/orchestrated_virtual_machine_scale_set_resource_test.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/compute/tests/orchestrated_virtual_machine_scale_set_resource_test.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/compute/tests/orchestrated_virtual_machine_scale_set_resource_test.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/compute/tests/orchestrated_virtual_machine_scale_set_resource_test.go
Outdated
Show resolved
Hide resolved
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" | ||
) | ||
|
||
func dataSourceArmVirtualMachineScaleSetOrchestratorVM() *schema.Resource { |
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.
what's the purpose of making this it's own data source? we may as well reuse the existing one
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.
Actually we currently do not have a data source for VMSS.
But I think it makes more sense to add a data source for all the types of VMSS. Removing this data source.
func testAccAzureRMOrchestratedVirtualMachineScaleSet_template(data acceptance.TestData) string { | ||
// in VMSS VMO mode, the `platform_fault_domain_count` has different acceptable values for different locations, | ||
// therefore this location is fixed to EastUS2 to make sure the acceptance test has no issues about this value | ||
location := "EastUS2" |
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.
almost all of the regions support 2 - so we can use a dynamic location and set this to 2? https://github.com/MicrosoftDocs/azure-docs/blob/master/includes/managed-disks-common-fault-domain-region-list.md
if necessary we can look to add a data source for this information that looks it up in the API - but for now it looks sufficient to hard-code this to 2
?
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.
Well, I just tried that eastus2 only accepts 5
.
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.
And I got some feedback from the service team, there is a difference when the VMSS is zonal or not. In this case, when zonal, eastus2 only supports platform_fault_domain_count = 5
.
Different locations have different zone support list as well.
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.
This is incongruous with the data in the link supplied in the docs below, which suggests 3
is the max for EastUS2
? (as does querying the API).
I've done a little digging and it would appear that the only value accepted for any supported region when zones
is set, is 5
, could you confirm this with the service team also? (and update code/docs accordingly).
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.
I could check with the service team about this....
But I am afraid that the problem remains: different locations support different list of zones, and the list of zones is subscription dependent.
However I am fine with replacing this hard-coded location with data.Locations.Primary
, what do you think? If you prefer we move this hard-coded location away, I will do it then
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.
And you can use this REST API https://management.azure.com/subscriptions/{subsID}/providers/Microsoft.Compute/?api-version=2019-07-01
to query the zone mappings in your subscription.
My result is:
"zoneMappings": [
{
"location": "East US 2",
"zones": [
"2",
"3",
"1"
]
},
{
"location": "Central US",
"zones": [
"2",
"3",
"1"
]
},
{
"location": "West Europe",
"zones": [
"2",
"3",
"1"
]
},
{
"location": "East US 2 EUAP",
"zones": [
"2",
"3",
"1"
]
},
{
"location": "Central US EUAP",
"zones": [
"1",
"2"
]
},
{
"location": "France Central",
"zones": [
"2",
"3",
"1"
]
},
{
"location": "Southeast Asia",
"zones": [
"2",
"3",
"1"
]
},
{
"location": "West US 2",
"zones": [
"2",
"3",
"1"
]
},
{
"location": "North Europe",
"zones": [
"2",
"3",
"1"
]
},
{
"location": "East US",
"zones": [
"2",
"3",
"1"
]
},
{
"location": "UK South",
"zones": [
"2",
"3",
"1"
]
},
{
"location": "Japan East",
"zones": [
"2",
"3",
"1"
]
},
{
"location": "Australia East",
"zones": []
},
{
"location": "South Africa North",
"zones": []
},
{
"location": "South Central US",
"zones": []
},
{
"location": "Canada Central",
"zones": []
}
],
azurerm/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go
Show resolved
Hide resolved
azurerm_orchestrated_virtual_machine_scale_set
azurerm_orchestrated_virtual_machine_scale_set
Hi @tombuildsstuff I have made some changes, could you please have a look? |
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.
Hi @ArcturusZhang
Tom's not around for a couple of days so I've taken a quick look over to help keep things moving.
To me this looks fine for what is a preview resource. I've made a couple of additional comments below, one on the API values which could be misleading / confusing to users; and another on what looks to have been a missed test update when you made zone
required when virtual_machine_scale_set_id
is specified.
virtual_machine_scale_set_id = azurerm_orchestrated_virtual_machine_scale_set.test.id | ||
} |
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.
Missing zone =
here?
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.
Oh, right! thanks for catching this.
func testAccAzureRMOrchestratedVirtualMachineScaleSet_template(data acceptance.TestData) string { | ||
// in VMSS VMO mode, the `platform_fault_domain_count` has different acceptable values for different locations, | ||
// therefore this location is fixed to EastUS2 to make sure the acceptance test has no issues about this value | ||
location := "EastUS2" |
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.
This is incongruous with the data in the link supplied in the docs below, which suggests 3
is the max for EastUS2
? (as does querying the API).
I've done a little digging and it would appear that the only value accepted for any supported region when zones
is set, is 5
, could you confirm this with the service team also? (and update code/docs accordingly).
Hi @jackofallops I have fixed the tests, please have a look. As for the |
Hi @ArcturusZhang
|
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.
Thanks @ArcturusZhang,
As the only outstanding comment is wrt testing i'm going to merge this for 2.11 - it would be great in the future to remove the hard coded location and write a data source to get the value from the API as tom suggested.
This has been released in version 2.11.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.11.0"
}
# ... other configuration ... |
Thanks @katbyte ! That would be ideal, but frankly I cannot find the the REST API equivalence to get the zone mappings in go SDK.... maybe it is not in the REST API specs... But we do have |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
This PR implements the new orchestration mode VM of VMSS by introducing the new resource
azurerm_orchestrated_virtual_machine_scale_set
.For more information about the orchestration mode of VMSS, please refer this doc
Fixes #6085