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_mobile_network_data_network; New DataSource: azurerm_mobile_network_data_network #20338

Merged
merged 13 commits into from
Feb 28, 2023

Conversation

ziyeqf
Copy link
Contributor

@ziyeqf ziyeqf commented Feb 7, 2023

an overall list is below. Detail of this RP could be found here

Though these PRs may have conflicts in merge sequence, but I think it should not block the review progress...

Over view

order | name 
0     | azurerm_mobile_network                              ✅
1     | azurerm_mobile_network_site                         #20334
1     | azurerm_mobile_network_data_network                 <- this one
1     | azurerm_mobile_network_service                      #20337
1     | azurerm_mobile_network_slice                        #20336 
1     | azurerm_mobile_network_sim_group                    #20339
2     | azurerm_mobile_network_packet_core_control_plane    
2     | azurerm_mobile_network_attached_data_network        
2     | azurerm_mobile_network_sim_policy                   
3     | azurerm_mobile_network_packet_core_data_plane       
4     | azurerm_mobile_network_attached_data_network        
5     | azurerm_mobile_network_sim        

Test

terraform-provider-azurerm ❯ TF_ACC=1 go test -v ./internal/services/mobilenetwork -run=TestAccMobileNetworkDataNetwork -timeout=600m                                                  [ tengzh/mn_dn][$+][🐹 v1.19.5][⏱ 3s][12:14:35]
=== RUN   TestAccMobileNetworkDataNetworkDataSource_complete
=== PAUSE TestAccMobileNetworkDataNetworkDataSource_complete
=== RUN   TestAccMobileNetworkDataNetwork_basic
=== PAUSE TestAccMobileNetworkDataNetwork_basic
=== RUN   TestAccMobileNetworkDataNetwork_requiresImport
=== PAUSE TestAccMobileNetworkDataNetwork_requiresImport
=== RUN   TestAccMobileNetworkDataNetwork_complete
=== PAUSE TestAccMobileNetworkDataNetwork_complete
=== RUN   TestAccMobileNetworkDataNetwork_update
=== PAUSE TestAccMobileNetworkDataNetwork_update
=== CONT  TestAccMobileNetworkDataNetworkDataSource_complete
=== CONT  TestAccMobileNetworkDataNetwork_complete
=== CONT  TestAccMobileNetworkDataNetwork_update
=== CONT  TestAccMobileNetworkDataNetwork_requiresImport
=== CONT  TestAccMobileNetworkDataNetwork_basic
--- PASS: TestAccMobileNetworkDataNetworkDataSource_complete (421.15s)
--- PASS: TestAccMobileNetworkDataNetwork_basic (429.70s)
--- PASS: TestAccMobileNetworkDataNetwork_complete (432.41s)
--- PASS: TestAccMobileNetworkDataNetwork_requiresImport (449.69s)
--- PASS: TestAccMobileNetworkDataNetwork_update (515.62s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/mobilenetwork 516.867s

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

LGTM ⛈️

Copy link
Member

@catriona-m catriona-m left a comment

Choose a reason for hiding this comment

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

Thanks @ziyeqf I've left two minor comments here but otherwise this LGTM!

Copy link
Member

@catriona-m catriona-m left a comment

Choose a reason for hiding this comment

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

Thanks @ziyeqf LGTM!

@catriona-m
Copy link
Member

Looks like this has some conflicts from merging the previous mobilenetwork PR, but we can marge this once these get resolved 👍

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @ziyeqf

Thanks for pushing those changes - I've taken a look through and left some comments inline, if we can fix those up then this should otherwise be good to go 👍

Thanks!

return fmt.Errorf("deleting %s: %+v", id, err)
}

if err := resourceMobileNetworkChildWaitForDeletion(ctx, id.ID(), func() (*http.Response, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there an API bug tracking this, so we know when this is safe to remove?

It's worth noting that these workarounds shouldn't be needed in time with the new base layer, since that should both check the LRO and continue polling until the resource is fully provisioned/gone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just know it should because some infra issue.. actually what I need is some delay, the resource has already been 404, but when delete the parent resource, it will get an error.. I can open an issue but I dont think it could be fixed..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just opened an issue for this..Azure/azure-rest-api-specs#22691

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, it might be better to add the workaround on delete function of azurerm_mobile_network instead of on children resources, WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

One of the design guarantees of Terraform is that it won't mark a resource as provisioned/gone until the resource is fully provisioned/removed - so we'd need this to be present within the child resources rather than the parent azurerm_mobile_network resource

website/docs/d/mobile_network_data_network.html.markdown Outdated Show resolved Hide resolved
website/docs/r/mobile_network_data_network.html.markdown Outdated Show resolved Hide resolved
website/docs/r/mobile_network_data_network.html.markdown Outdated Show resolved Hide resolved
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @ziyeqf

Thanks for pushing those changes - taking a look through here this is mostly looking good to me now, I've left some minor comments inline (and called out a few FYI's, which aren't blockers) but if we can fix those up this should otherwise be good to go 👍

Thanks!

Comment on lines +4 to 7
"github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/datanetwork"
"github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork"
"github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service"
"github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup"
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't something we need to change now, but I wanted to call out that hashicorp/go-azure-sdk supports Meta Clients for each API Version - so if an entire Service is using a single API Version (as is the case here) - rather than defining the Client and the Resources to use inline (as we're doing here) we can instead use the Meta Client as per datadog to automatically have access to all clients, rather than defining these by hand.

Again, this isn't something we need to change now, but should make it easier to import the Client one-time (since we try and stick to a single API Version for each Service where possible) rather than adding these across different PR's :)

return fmt.Errorf("deleting %s: %+v", id, err)
}

if err := resourceMobileNetworkChildWaitForDeletion(ctx, id.ID(), func() (*http.Response, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

One of the design guarantees of Terraform is that it won't mark a resource as provisioned/gone until the resource is fully provisioned/removed - so we'd need this to be present within the child resources rather than the parent azurerm_mobile_network resource

@ziyeqf
Copy link
Contributor Author

ziyeqf commented Feb 27, 2023

test

terraform-provider-azurerm ❯ TF_ACC=1 go test -v ./internal/services/mobilenetwork  -run=TestAccMobileNetworkDataNetwork -timeout=600m                                                 [ tengzh/mn_dn][$!][🐹 v1.19.6][⏱ 1s][13:57:32]
=== RUN   TestAccMobileNetworkDataNetworkDataSource_complete
=== PAUSE TestAccMobileNetworkDataNetworkDataSource_complete
=== RUN   TestAccMobileNetworkDataNetwork_basic
=== PAUSE TestAccMobileNetworkDataNetwork_basic
=== RUN   TestAccMobileNetworkDataNetwork_requiresImport
=== PAUSE TestAccMobileNetworkDataNetwork_requiresImport
=== RUN   TestAccMobileNetworkDataNetwork_complete
=== PAUSE TestAccMobileNetworkDataNetwork_complete
=== RUN   TestAccMobileNetworkDataNetwork_update
=== PAUSE TestAccMobileNetworkDataNetwork_update
=== CONT  TestAccMobileNetworkDataNetworkDataSource_complete
=== CONT  TestAccMobileNetworkDataNetwork_complete
=== CONT  TestAccMobileNetworkDataNetwork_requiresImport
=== CONT  TestAccMobileNetworkDataNetwork_update
=== CONT  TestAccMobileNetworkDataNetwork_basic
--- PASS: TestAccMobileNetworkDataNetwork_basic (677.01s)
--- PASS: TestAccMobileNetworkDataNetwork_complete (679.38s)
--- PASS: TestAccMobileNetworkDataNetworkDataSource_complete (691.17s)
--- PASS: TestAccMobileNetworkDataNetwork_requiresImport (709.30s)
--- PASS: TestAccMobileNetworkDataNetwork_update (918.91s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/mobilenetwork 920.113s

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @ziyeqf - LGTM ☎️

@katbyte katbyte merged commit 1f1567a into hashicorp:main Feb 28, 2023
@github-actions github-actions bot added this to the v3.46.0 milestone Feb 28, 2023
katbyte added a commit that referenced this pull request Feb 28, 2023
@github-actions
Copy link

github-actions bot commented Mar 6, 2023

This functionality has been released in v3.46.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!

@github-actions
Copy link

github-actions bot commented Apr 6, 2023

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 6, 2023
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.

4 participants