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

add new resource & data source: azurerm_netapp_account #4416

Merged
merged 17 commits into from
Nov 15, 2019

Conversation

neil-yechenwei
Copy link
Contributor

@neil-yechenwei neil-yechenwei commented Sep 24, 2019

This PR is code implement for issue #4417

@jstewart612
Copy link

Ping. Pong?

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.

Hi @neil-yechenwei

Thank you for the PR, i've left some comments inline that need to be addressed before merging.

azurerm/data_source_netapp_account.go Outdated Show resolved Hide resolved
azurerm/data_source_netapp_account.go Outdated Show resolved Hide resolved
azurerm/data_source_netapp_account.go Outdated Show resolved Hide resolved
azurerm/data_source_netapp_account.go Outdated Show resolved Hide resolved
azurerm/internal/tags/flatten.go Outdated Show resolved Hide resolved
website/docs/r/netapp_account.html.markdown Outdated Show resolved Hide resolved
website/docs/r/netapp_account.html.markdown Outdated Show resolved Hide resolved
website/docs/r/netapp_account.html.markdown Outdated Show resolved Hide resolved
website/docs/d/netapp_account.html.markdown Outdated Show resolved Hide resolved
website/docs/d/netapp_account.html.markdown Outdated Show resolved Hide resolved
@ghost ghost removed the waiting-response label Oct 7, 2019
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 revisions @neil-yechenwei! looking much better.

It looks like there can be only one active_directory block:

------- Stdout: -------
=== RUN   TestAccAzureRMNetAppAccount_update
=== PAUSE TestAccAzureRMNetAppAccount_update
=== CONT  TestAccAzureRMNetAppAccount_update
--- FAIL: TestAccAzureRMNetAppAccount_update (83.58s)
    testing.go:569: Step 1 error: errors during apply:
        
        Error: Error creating NetApp Account "acctest-NetAppAccount-191008004136081477" (Resource Group "acctestRG-191008004136081477"): netapp.AccountsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="ErrorUpsertingActiveDirectory" Message="Only one active directory allowed"
        
          on /opt/teamcity-agent/temp/buildTmp/tf-test307630958/main.tf line 7:
          (source code not available)

azurerm/resource_arm_netapp_account.go Outdated Show resolved Hide resolved
azurerm/data_source_netapp_account.go Outdated Show resolved Hide resolved
azurerm/data_source_netapp_account.go Outdated Show resolved Hide resolved
azurerm/resource_arm_netapp_account.go Outdated Show resolved Hide resolved
azurerm/resource_arm_netapp_account.go Outdated Show resolved Hide resolved
website/docs/r/netapp_account.html.markdown Outdated Show resolved Hide resolved
website/docs/r/netapp_account.html.markdown Outdated Show resolved Hide resolved
website/docs/r/netapp_account.html.markdown Outdated Show resolved Hide resolved
website/docs/r/netapp_account.html.markdown Outdated Show resolved Hide resolved
azurerm/resource_arm_netapp_account.go Show resolved Hide resolved
@neil-yechenwei
Copy link
Contributor Author

neil-yechenwei commented Oct 9, 2019

Thanks for the comments @katbyte . After checked for this resource in Azure portal, it only supports one active directory. So I added attribute "MaxItems: 1".
Azure Rest API doc for NetApp Account:
image
NetApp Resource in Azure Portal:
image

@ghost ghost removed the waiting-response label Oct 9, 2019
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 revisions @neil-yechenwei,

In addition to the comments i've left inline the update test is still broken:

------- Stdout: -------
=== RUN   TestAccAzureRMNetAppAccount_update
=== PAUSE TestAccAzureRMNetAppAccount_update
=== CONT  TestAccAzureRMNetAppAccount_update
--- FAIL: TestAccAzureRMNetAppAccount_update (91.27s)
    testing.go:569: Step 1 error: errors during apply:
        
        Error: Error creating NetApp Account "acctest-NetAppAccount-191009061916948164" (Resource Group "acctestRG-netapp-191009061916948164"): netapp.AccountsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="ErrorUpsertingActiveDirectory" Message="Only one active directory allowed"

there could be a default one created if you don't specify one??

azurerm/data_source_netapp_account.go Outdated Show resolved Hide resolved
azurerm/resource_arm_netapp_account.go Outdated Show resolved Hide resolved
website/docs/r/netapp_account.html.markdown Outdated Show resolved Hide resolved
@neil-yechenwei
Copy link
Contributor Author

Hi @katbyte ,

Thank you for the comments, I've updated code, thanks.

@ghost ghost removed the waiting-response label Oct 22, 2019
Copy link
Member

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

hi @neil-yechenwei

Thanks for pushing those changes - I've taken a look through and left some extra comments in addition to @katbyte's - but if we can fix those up and the tests pass this should otherwise be good.

Thanks!

azurerm/data_source_netapp_account.go Outdated Show resolved Hide resolved
azurerm/data_source_netapp_account.go Outdated Show resolved Hide resolved
azurerm/internal/services/netapp/client.go Outdated Show resolved Hide resolved
azurerm/internal/services/netapp/validate.go Outdated Show resolved Hide resolved
azurerm/internal/services/netapp/validate.go Outdated Show resolved Hide resolved
website/docs/r/netapp_account.html.markdown Outdated Show resolved Hide resolved
website/docs/r/netapp_account.html.markdown Outdated Show resolved Hide resolved
website/docs/r/netapp_account.html.markdown Outdated Show resolved Hide resolved
azurerm/resource_arm_netapp_account_test.go Outdated Show resolved Hide resolved
azurerm/resource_arm_netapp_account.go Outdated Show resolved Hide resolved
Copy link
Member

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

hi @neil-yechenwei

Thanks for pushing those changes - I've taken a look through and left some extra comments in addition to @katbyte's - but if we can fix those up and the tests pass this should otherwise be good.

Thanks!

@neil-yechenwei
Copy link
Contributor Author

neil-yechenwei commented Oct 25, 2019

@tombuildsstuff , I've updated code by your comments. Thanks.

@ghost ghost removed the waiting-response label Oct 25, 2019
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 addressing those comments @neil-yechenwei,

I've answered some of your questions and let a couple more comments inline.

We don't need to write acctests to test validation functions, and if we just use the validation.stringmatch we don't need a test at all

azurerm/resource_arm_netapp_account_test.go Outdated Show resolved Hide resolved
azurerm/resource_arm_netapp_account_test.go Outdated Show resolved Hide resolved
azurerm/resource_arm_netapp_account_test.go Outdated Show resolved Hide resolved
azurerm/internal/services/netapp/validate.go Outdated Show resolved Hide resolved
azurerm/internal/services/netapp/validate.go Outdated Show resolved Hide resolved
@neil-yechenwei
Copy link
Contributor Author

@katbyte ,Thanks for your comments. I've updated code by your comments.

@ghost ghost removed the waiting-response label Oct 29, 2019
@katbyte katbyte added this to the v1.37.0 milestone Oct 31, 2019
@katbyte katbyte self-assigned this Oct 31, 2019
@jstewart612
Copy link

We're using ANF a lot more and are eager for this feature. Near as I can tell, @katbyte and @tombuildsstuff , @neil-yechenwei has implemented your latest round of changes from your reviews. Anything else blocking? I'm not an allowed reviewer, obviously.

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 revisions @neil-yechenwei, this LGTM now!

password = "aduserpwd"
smb_server_name = "SMBSERVER"
dns_servers = ["1.2.3.4"]
domain = "westcentralus.com"
Copy link
Collaborator

Choose a reason for hiding this comment

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

confirmed this, when you try and set two different ones you get:

 Error: Error waiting for creation of NetApp Account "acctest-NetAppAccount-191114162218570150" (Resource Group "acctestRG-netapp-191114162218570150"): Code="InternalServerError" Message="Error creating ActiveDirectory."

🤷‍♀

@katbyte katbyte changed the title Add new resource for NetApp Account Add new resource & data source: azurerm_netapp_account Nov 15, 2019
@katbyte katbyte changed the title Add new resource & data source: azurerm_netapp_account add new resource & data source: azurerm_netapp_account Nov 15, 2019
@katbyte katbyte merged commit 2ccff85 into hashicorp:master Nov 15, 2019
katbyte added a commit that referenced this pull request Nov 15, 2019
@neil-yechenwei
Copy link
Contributor Author

neil-yechenwei commented Nov 15, 2019

@katbyte , I am not sure what you mean about "confirmed this, when you try and set two different ones you get:". Are you trying to test for changing the active directory from A to B, right? If yes, it seems that it works fine from my side. If not, could you share me the code example? Thanks.
image
image

jackbatzner pushed a commit to jackbatzner/terraform-provider-azurerm that referenced this pull request Nov 15, 2019
jackbatzner pushed a commit to jackbatzner/terraform-provider-azurerm that referenced this pull request Nov 15, 2019
@ghost
Copy link

ghost commented Nov 26, 2019

This has been released in version 1.37.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 = "~> 1.37.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
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

4 participants