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

Managed Disk Resource: Added support for network_access_policy #9862

Merged
merged 7 commits into from
Apr 29, 2021

Conversation

cmendible
Copy link
Contributor

Fixes: #9796

@martinbjorgan
Copy link
Contributor

martinbjorgan commented Dec 15, 2020

@cmendible I was also working on this, you beat me to it :)
I think we also should add the disk_access_id parameter to the managed disk resource since that is required if AllowPrivate is used? And also add azurerm_disk_access as a new resource?

@cmendible
Copy link
Contributor Author

cmendible commented Dec 15, 2020

Hi! That's the reason I added the WIP prefix. We need to be sure what else is needed for that specific case...

@martinbjorgan
Copy link
Contributor

@cmendible Missed that! Sorry :)

@cmendible
Copy link
Contributor Author

@martinbjorgan confirmed here that disk_access_id is required when the NeworkAccessPolicy is set to AllowPrivate and also that the field is supported in update operations: Disks - Create Or Update.

Can you open an issue to add azurerm_disk_access as a new resource so you can tackle that one?

@martinbjorgan
Copy link
Contributor

@cmendible Sure, I'll give it a whirl

@cmendible cmendible force-pushed the issue-9796 branch 2 times, most recently from 4413125 to f759b58 Compare December 17, 2020 08:11
@cmendible
Copy link
Contributor Author

PR #9889 (adds the azurerm_disk_access resource) must be merged so we can add a test for network_access_policy = AllowPrivate which requires a disk_access_id

@martinbjorgan
Copy link
Contributor

@cmendible I'm almost done with tests for the resource, data source is done.
Hopefully I'm done with those after the 24th

@ghost ghost added size/XL documentation and removed size/L labels Jan 11, 2021
@cmendible cmendible changed the title [WIP] Managed Disk Resource: Added support for network_access_policy Managed Disk Resource: Added support for network_access_policy Jan 11, 2021
@cmendible
Copy link
Contributor Author

PR #9889 (adds the azurerm_disk_access resource) must be merged so we can add a test for network_access_policy = AllowPrivate which requires a disk_access_id

PR #9889 was merged and test for network_access_policy = AllowPrivate are in place.

@katbyte can you please review this one?

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 for the PR @cmendible - overall this looks great! i've just left some comments inline to address before merge

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 @cmendible - but i think this change is going to break existing configs as tests are now failing with:

An execution plan has been generated and is shown below.
        Resource actions are indicated with the following symbols:
          ~ update in-place
        
        Terraform will perform the following actions:
        
          # azurerm_managed_disk.test will be updated in-place
          ~ resource "azurerm_managed_disk" "test" {
                id                    = "/subscriptions/*******/resourceGroups/acctestRG-210415031958219440/providers/Microsoft.Compute/disks/acctestd-210415031958219440"
                name                  = "acctestd-210415031958219440"
              - network_access_policy = "AllowAll" -> null
                tags                  = {
                    "cost-center" = "ops"
                    "environment" = "acctest"
                }
                # (7 unchanged attributes hidden)
        
                # (1 unchanged block hidden)
            }

maybe we need to mark that as computed?

@cmendible cmendible requested a review from katbyte April 15, 2021 13:55
@cmendible
Copy link
Contributor Author

Thanks @cmendible - but i think this change is going to break existing configs as tests are now failing with:

An execution plan has been generated and is shown below.
        Resource actions are indicated with the following symbols:
          ~ update in-place
        
        Terraform will perform the following actions:
        
          # azurerm_managed_disk.test will be updated in-place
          ~ resource "azurerm_managed_disk" "test" {
                id                    = "/subscriptions/*******/resourceGroups/acctestRG-210415031958219440/providers/Microsoft.Compute/disks/acctestd-210415031958219440"
                name                  = "acctestd-210415031958219440"
              - network_access_policy = "AllowAll" -> null
                tags                  = {
                    "cost-center" = "ops"
                    "environment" = "acctest"
                }
                # (7 unchanged attributes hidden)
        
                # (1 unchanged block hidden)
            }

maybe we need to mark that as computed?

@katbyte I ran some tests and it should be fixed.

@ghost ghost removed the waiting-response label Apr 15, 2021
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 @cmendible - overall looks good and i've left some comments inline

@ghost ghost added size/L and removed size/XL labels Apr 26, 2021
@cmendible cmendible requested a review from katbyte April 26, 2021 08:15
@katbyte katbyte added this to the v2.57.0 milestone Apr 28, 2021
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 @cmendible - aside from the tests failing with:

------- Stdout: -------
=== RUN   TestAccAzureRMManagedDisk_networkPolicy
=== PAUSE TestAccAzureRMManagedDisk_networkPolicy
=== CONT  TestAccAzureRMManagedDisk_networkPolicy
    testing.go:620: Step 1/2 error: Error running apply: exit status 1
        
        Error: [ERROR] disk_iops_read_write and disk_mbps_read_write are only available for UltraSSD disks
        
          on terraform_plugin_test.tf line 11, in resource "azurerm_managed_disk" "test":
          11: resource "azurerm_managed_disk" "test" {
        
--- FAIL: TestAccAzureRMManagedDisk_networkPolicy (104.83s)
FAIL

------- Stderr: -------
2021/04/28 06:39:36 [DEBUG] not using binary driver name, it's no longer needed
2021/04/28 06:39:36 [DEBUG] not using binary driver name, it's no longer needed

this is looking good to go!

@cmendible
Copy link
Contributor Author

@katbyte fixed the tests in: d64af57

@ghost ghost removed the waiting-response label Apr 28, 2021
@cmendible cmendible requested a review from katbyte April 28, 2021 20:22
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.

@cmendible - looks like we have another casing issue 😪

------- Stdout: -------
=== RUN   TestAccAzureRMManagedDisk_networkPolicy_create_withAllowPrivate
=== PAUSE TestAccAzureRMManagedDisk_networkPolicy_create_withAllowPrivate
=== CONT  TestAccAzureRMManagedDisk_networkPolicy_create_withAllowPrivate
    testing.go:620: Step 1/2 error: After applying this test step, the plan was not empty.
        stdout:
        
        
        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
          ~ update in-place
        
        Terraform will perform the following actions:
        
          # azurerm_managed_disk.test will be updated in-place
          ~ resource "azurerm_managed_disk" "test" {
              ~ disk_access_id        = "/subscriptions/*******/resourceGroups/ACCTESTRG-210428201256204039/providers/Microsoft.Compute/diskAccesses/accda210428201256204039" -> "/subscriptions/*******/resourceGroups/acctestRG-210428201256204039/providers/Microsoft.Compute/diskAccesses/accda210428201256204039"
                id                    = "/subscriptions/*******/resourceGroups/acctestRG-210428201256204039/providers/Microsoft.Compute/disks/acctestd-210428201256204039"
                name                  = "acctestd-210428201256204039"
                tags                  = {
                    "cost-center" = "ops"
                    "environment" = "acctest"
                }
                # (9 unchanged attributes hidden)
            }
        
        Plan: 0 to add, 1 to change, 0 to destroy.
--- FAIL: TestAccAzureRMManagedDisk_networkPolicy_create_withAllowPrivate (189.25s)
FAIL

------- Stderr: -------
2021/04/28 20:12:54 [DEBUG] not using binary driver name, it's no longer needed
2021/04/28 20:12:55 [DEBUG] not using binary driver name, it's no longer needed

could we open an issue on the SDK describing this issue and link to it on the property? which i believe we'll need to diffsuppress case

@cmendible
Copy link
Contributor Author

Opened issue to the Azure SDK team here: Azure/azure-rest-api-specs#14192

And suppress.CaseDifference added to the code here: f0cc2de

@cmendible cmendible requested a review from katbyte April 29, 2021 15:37
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 @cmendible - LGTM 👍

@katbyte katbyte merged commit e1886b2 into hashicorp:master Apr 29, 2021
katbyte added a commit that referenced this pull request Apr 29, 2021
@ghost
Copy link

ghost commented Apr 30, 2021

This has been released in version 2.57.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.57.0"
}
# ... other configuration ...

@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 30, 2021
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.

Support for azurerm_managed_disk
3 participants