-
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 : azurerm_storage_mover_target_endpoint
and azurerm_storage_mover_source_endpoint
#21449
New Resource : azurerm_storage_mover_target_endpoint
and azurerm_storage_mover_source_endpoint
#21449
Conversation
azurerm_storage_mover_target_endpoint
, azurerm_storage_mover_source_endpoint
- Support storage mover endpontazurerm_storage_mover_target_endpoint
and azurerm_storage_mover_source_endpoint
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.
Hey @sinbai! Thanks for this PR. It looks fairly good except one of the attributes isn't required and the test config could be cleaned up a bit.
func (r StorageMoverSourceEndpointTestResource) basic(data acceptance.TestData) string { | ||
template := r.template(data) | ||
return fmt.Sprintf(` | ||
provider "azurerm" { |
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.
Could this be moved into the template?
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 your feedback. Putting it outside of template because I got feedback from Tom a few days ago - "the provider block should be in each test, not the template - to allow for overriding it", see below for details. I assume that his feedback makes sense and I've been doing it ever since, WDYT?
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.
Ohhh good to note! Thank you!
provider "azurerm" { | ||
features {} | ||
} | ||
%s |
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.
The indention is off 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.
Fixed.
|
||
"export": { | ||
Type: pluginsdk.TypeString, | ||
Required: 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.
I don't believe this is Required. The api accepts ""
.
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.
Yes, you are right. The code has been updated.
} | ||
|
||
properties := endpoints.Endpoint{ | ||
Name: utils.String(model.Name), |
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.
per the ARM spec it's not valid to specify name
in the payload
Name: utils.String(model.Name), |
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.
Fixed.
Host: model.Host, | ||
NfsVersion: &model.NfsVersion, | ||
}, | ||
Type: utils.String(string(endpoints.EndpointTypeNfsMount)), |
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.
the type
field should never need to be set, this is implied from the ARM endpoint:
Type: utils.String(string(endpoints.EndpointTypeNfsMount)), |
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.
Fixed.
} | ||
|
||
if model := resp.Model; model != nil { | ||
nfsProperties := model.Properties.(endpoints.NfsMountEndpointProperties) |
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.
we're not type checking this, if the cast fails this'll panic
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.
Fixed.
} | ||
|
||
if metadata.ResourceData.HasChange("description") { | ||
nfsProperties := properties.Properties.(endpoints.NfsMountEndpointProperties) |
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.
we're not type checking this, if the cast fails this'll panic
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.
Fixed.
BlobContainerName: model.StorageContainerName, | ||
StorageAccountResourceId: model.StorageAccountId, | ||
}, | ||
Type: utils.String(string(endpoints.EndpointTypeAzureStorageBlobContainer)), |
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.
(as above)
Type: utils.String(string(endpoints.EndpointTypeAzureStorageBlobContainer)), |
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.
Fixed.
} | ||
|
||
properties := endpoints.Endpoint{ | ||
Name: utils.String(model.Name), |
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.
(as above)
Name: utils.String(model.Name), |
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.
Fixed.
} | ||
|
||
if metadata.ResourceData.HasChange("description") { | ||
sbcProperties := properties.Properties.(endpoints.AzureStorageBlobContainerEndpointProperties) |
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.
(as above)
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.
Fixed.
} | ||
|
||
if model := resp.Model; model != nil { | ||
sbcProperties := model.Properties.(endpoints.AzureStorageBlobContainerEndpointProperties) |
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.
(as above)
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.
Fixed.
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.
Sorry for the mis-review. I didn't see @tombuildsstuff review until after I pushed my review
5d87579
to
35488d9
Compare
35488d9
to
4409b27
Compare
@tombuildsstuff Thanks for your feedback. I have fixed all feedback. Could you please take another 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.
LGTM! Thanks for getting those changes in @sinbai
This functionality has been released in v3.53.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Swagger: https://github.com/Azure/azure-rest-api-specs/blob/add28efcd3a5fd422285d992fb1ec5ee5a7a40a6/specification/storagemover/resource-manager/Microsoft.StorageMover/stable/2023-03-01/storagemover.json#L674
Test results: