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_container_connected_registry #15731

Merged
merged 5 commits into from
Apr 14, 2022

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented Mar 8, 2022

This PR implements a new resource: azurerm_container_connected_registry.

Reference

https://docs.microsoft.com/en-us/azure/container-registry/intro-connected-registry

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 @magodo, in addition to my comments inline looks like the tests are failing:

------- Stdout: -------
=== RUN   TestAccContainerConnectedRegistry_mirror
=== PAUSE TestAccContainerConnectedRegistry_mirror
=== CONT  TestAccContainerConnectedRegistry_mirror
    testcase.go:110: Step 1/2 error: Error running apply: exit status 1
        
        Error: checking for presence of existing Container Connected Registry: (Connected Registry Name "testacccrc220322210138990297" / Registry Name "testacccr220322210138990297" / Resource Group "acctestRG-acr-220322210138990297"): containerregistry.ConnectedRegistriesClient#Get: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: error response cannot be parsed: "\"The resource type 'connectedRegistries' is not supported in this region.\"" error: json: cannot unmarshal string into Go value of type azure.RequestError
        
          with azurerm_container_connected_registry.test,
          on terraform_plugin_test.tf line 40, in resource "azurerm_container_connected_registry" "test":
          40: resource "azurerm_container_connected_registry" "test" {
        
        checking for presence of existing Container Connected Registry: (Connected
        Registry Name "testacccrc220322210138990297" / Registry Name
        "testacccr220322210138990297" / Resource Group
        "acctestRG-acr-220322210138990297"):
        containerregistry.ConnectedRegistriesClient#Get: Failure responding to
        request: StatusCode=400 -- Original Error: autorest/azure: error response
        cannot be parsed: "\"The resource type 'connectedRegistries' is not supported
        in this region.\"" error: json: cannot unmarshal string into Go value of type
        azure.RequestError
--- FAIL: TestAccContainerConnectedRegistry_mirror (172.11s)
FAIL

),
},

"notification_list": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

list is redundant, also what type of destination is expected here?

Suggested change
"notification_list": {
"notification": {

also crazy idea, would it make sense to break this out into blocks validating each component? open to input on that

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@katbyte Good idea, I'll make the change.

@magodo
Copy link
Collaborator Author

magodo commented Mar 23, 2022

@katbyte I've now refactored the notification from list of string into blocks. Please take another look! About the test failures, from the error message, it seems you are running it in a region that doesn't support the connected registry? At least west Europe should support that.

Test

terraform-provider-azurerm on  acr_conn_reg via 🐹 v1.18 took 6s
💤  TF_ACC=1 go test -v -timeout=20h ./internal/services/containers  -run='TestAccContainerConnectedRegistry_'
=== RUN   TestAccContainerConnectedRegistry_basic
=== PAUSE TestAccContainerConnectedRegistry_basic
=== RUN   TestAccContainerConnectedRegistry_complete
=== PAUSE TestAccContainerConnectedRegistry_complete
=== RUN   TestAccContainerConnectedRegistry_update
=== PAUSE TestAccContainerConnectedRegistry_update
=== RUN   TestAccContainerConnectedRegistry_mirror
=== PAUSE TestAccContainerConnectedRegistry_mirror
=== RUN   TestAccContainerConnectedRegistry_registry
=== PAUSE TestAccContainerConnectedRegistry_registry
=== RUN   TestAccContainerConnectedRegistry_cascaded
=== PAUSE TestAccContainerConnectedRegistry_cascaded
=== RUN   TestAccContainerConnectedRegistry_requiresImport
=== PAUSE TestAccContainerConnectedRegistry_requiresImport
=== CONT  TestAccContainerConnectedRegistry_basic
=== CONT  TestAccContainerConnectedRegistry_registry
=== CONT  TestAccContainerConnectedRegistry_update
=== CONT  TestAccContainerConnectedRegistry_mirror
=== CONT  TestAccContainerConnectedRegistry_complete
=== CONT  TestAccContainerConnectedRegistry_requiresImport
=== CONT  TestAccContainerConnectedRegistry_cascaded
--- PASS: TestAccContainerConnectedRegistry_complete (158.29s)
--- PASS: TestAccContainerConnectedRegistry_mirror (164.51s)
--- PASS: TestAccContainerConnectedRegistry_requiresImport (189.01s)
--- PASS: TestAccContainerConnectedRegistry_cascaded (222.85s)
--- PASS: TestAccContainerConnectedRegistry_registry (223.45s)
--- PASS: TestAccContainerConnectedRegistry_basic (774.41s)
--- PASS: TestAccContainerConnectedRegistry_update (1015.60s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/containers    1015.618s

@katbyte
Copy link
Collaborator

katbyte commented Apr 7, 2022

@magodo its just a standards TC run:

------- Stdout: -------
=== RUN   TestAccContainerConnectedRegistry_update
=== PAUSE TestAccContainerConnectedRegistry_update
=== CONT  TestAccContainerConnectedRegistry_update
    testcase.go:110: Step 1/6 error: Error running apply: exit status 1
        
        Error: checking for presence of existing Container Connected Registry: (Connected Registry Name "testacccrc220407005833738639" / Registry Name "testacccr220407005833738639" / Resource Group "acctestRG-acr-220407005833738639"): containerregistry.ConnectedRegistriesClient#Get: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: error response cannot be parsed: {"\"The resource type 'connectedRegistries' is not supported in this region.\"" '\x00' '\x00'} error: json: cannot unmarshal string into Go value of type azure.RequestError
        
          with azurerm_container_connected_registry.test,
          on terraform_plugin_test.tf line 45, in resource "azurerm_container_connected_registry" "test":
          45: resource "azurerm_container_connected_registry" "test" {
        
        checking for presence of existing Container Connected Registry: (Connected
        Registry Name "testacccrc220407005833738639" / Registry Name
        "testacccr220407005833738639" / Resource Group
        "acctestRG-acr-220407005833738639"):
        containerregistry.ConnectedRegistriesClient#Get: Failure responding to
        request: StatusCode=400 -- Original Error: autorest/azure: error response
        cannot be parsed: {"\"The resource type 'connectedRegistries' is not
        supported in this region.\"" '\x00' '\x00'} error: json: cannot unmarshal
        string into Go value of type azure.RequestError
--- FAIL: TestAccContainerConnectedRegistry_update (119.03s)
FAIL

primary location is west eu

@magodo
Copy link
Collaborator Author

magodo commented Apr 7, 2022

@katbyte I assume that is because the dynamic test is enabled for this run, as you can see some tests are passing:

image

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 @magodo - LGTM aside from 1 comment

website/docs/r/container_connected_registry.html.markdown Outdated Show resolved Hide resolved
@katbyte katbyte merged commit 37ce369 into hashicorp:main Apr 14, 2022
@github-actions github-actions bot added this to the v3.2.0 milestone Apr 14, 2022
katbyte added a commit that referenced this pull request Apr 14, 2022
@github-actions
Copy link

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

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 May 15, 2022
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.

None yet

2 participants