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_storage_mover_target_endpoint and azurerm_storage_mover_source_endpoint #21449

Merged
merged 12 commits into from
Apr 20, 2023

Conversation

@sinbai sinbai changed the title azurerm_storage_mover_target_endpoint, azurerm_storage_mover_source_endpoint - Support storage mover endpont New Resource : azurerm_storage_mover_target_endpoint and azurerm_storage_mover_source_endpoint Apr 18, 2023
Copy link
Member

@mbfrahry mbfrahry left a 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" {
Copy link
Member

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?

Copy link
Contributor Author

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?
image

Copy link
Member

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
Copy link
Member

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

Copy link
Contributor Author

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,
Copy link
Member

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 "".

Copy link
Contributor Author

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.

@sinbai
Copy link
Contributor Author

sinbai commented Apr 19, 2023

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.

Hi @mbfrahry thanks for your detailed feedback. I have replied/updated the code. Could you please take another look?

}

properties := endpoints.Endpoint{
Name: utils.String(model.Name),
Copy link
Contributor

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

Suggested change
Name: utils.String(model.Name),

Copy link
Contributor Author

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)),
Copy link
Contributor

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:

Suggested change
Type: utils.String(string(endpoints.EndpointTypeNfsMount)),

Copy link
Contributor Author

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)
Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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

Copy link
Contributor Author

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)),
Copy link
Contributor

Choose a reason for hiding this comment

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

(as above)

Suggested change
Type: utils.String(string(endpoints.EndpointTypeAzureStorageBlobContainer)),

Copy link
Contributor Author

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),
Copy link
Contributor

Choose a reason for hiding this comment

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

(as above)

Suggested change
Name: utils.String(model.Name),

Copy link
Contributor Author

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

(as above)

Copy link
Contributor Author

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

(as above)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

mbfrahry

This comment was marked as outdated.

Copy link
Member

@mbfrahry mbfrahry left a 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

@sinbai sinbai force-pushed the storagemover/new_resource_endpoint branch from 5d87579 to 35488d9 Compare April 20, 2023 08:06
@sinbai sinbai force-pushed the storagemover/new_resource_endpoint branch from 35488d9 to 4409b27 Compare April 20, 2023 08:23
@sinbai
Copy link
Contributor Author

sinbai commented Apr 20, 2023

@tombuildsstuff Thanks for your feedback. I have fixed all feedback. Could you please take another look?

Test results:
image

Copy link
Member

@mbfrahry mbfrahry left a 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

@mbfrahry mbfrahry added this to the v3.53.0 milestone Apr 20, 2023
@mbfrahry mbfrahry merged commit 748b561 into hashicorp:main Apr 20, 2023
mbfrahry added a commit that referenced this pull request Apr 20, 2023
@github-actions
Copy link

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!

@sinbai sinbai deleted the storagemover/new_resource_endpoint branch March 28, 2024 02:50
Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants