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

Support for Azure Active Directory for Azure Service fabric #2553

Merged
merged 24 commits into from
Jan 3, 2019

Conversation

DenheenJ
Copy link
Contributor

This PR adds support for Azure Active Directory (azure_active_directory) for Azure Service fabric (azurerm_service_fabric_cluster)

Addresses issue #2539

Terraform will perform the following actions:

-/+ azurerm_service_fabric_cluster.test (new resource required)
      id:                                                        "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ServiceFabric/clusters/test" => <computed> (forces new resource)
      add_on_features.#:                                         "2" => "2"
      add_on_features.1911128025:                                "DnsService" => "DnsService"
      add_on_features.2685698132:                                "RepairManager" => "RepairManager"
      azure_active_directory.#:                                  "0" => "1"
      azure_active_directory.0.client_application_id:            "" => "00000000-0000-0000-0000-000000000000" (forces new resource)
      azure_active_directory.0.cluster_application_id:           "" => "00000000-0000-0000-0000-000000000000" (forces new resource)
      azure_active_directory.0.tenant_id:                        "" => "00000000-0000-0000-0000-000000000000" (forces new resource)
      certificate.#:                                             "1" => "1"
      certificate.0.thumbprint:                                  "0000000000000000000000000000000000000000" => "0000000000000000000000000000000000000000"
      certificate.0.x509_store_name:                             "My" => "My"
      client_certificate_thumbprint.#:                           "1" => "1"
      client_certificate_thumbprint.0.is_admin:                  "true" => "true"
      client_certificate_thumbprint.0.thumbprint:                "0000000000000000000000000000000000000000" => "0000000000000000000000000000000000000000"
      cluster_code_version:                                      "6.4.617.9590" => <computed>
      cluster_endpoint:                                          "https://northeurope.servicefabric.azure.com/runtime/clusters/00000000-0000-0000-0000-000000000000" => <computed>
      diagnostics_config.#:                                      "1" => "1"
      diagnostics_config.0.blob_endpoint:                        "https://test.blob.core.windows.net/" => "https://test.blob.core.windows.net/"
      diagnostics_config.0.protected_account_key_name:           "StorageAccountKey1" => "StorageAccountKey1"
      diagnostics_config.0.queue_endpoint:                       "https://test.queue.core.windows.net/" => "https://test.queue.core.windows.net/"
      diagnostics_config.0.storage_account_name:                 "test" => "test"
      diagnostics_config.0.table_endpoint:                       "https://test.table.core.windows.net/" => "https://test.table.core.windows.net/"
      fabric_settings.#:                                         "2" => "2"
      fabric_settings.0.name:                                    "Security" => "Security"
      fabric_settings.0.parameters.%:                            "1" => "1"
      fabric_settings.0.parameters.ClusterProtectionLevel:       "EncryptAndSign" => "EncryptAndSign"
      fabric_settings.1.name:                                    "ClusterManager" => "ClusterManager"
      fabric_settings.1.parameters.%:                            "1" => "1"
      fabric_settings.1.parameters.EnableDefaultServicesUpgrade: "true" => "true"
      location:                                                  "northeurope" => "northeurope"
      management_endpoint:                                       "https://10.0.0.20:19080" => "https://10.0.0.20:19080"
      name:                                                      "test" => "test"
      node_type.#:                                               "1" => "1"
      node_type.0.application_ports.#:                           "1" => <computed>
      node_type.0.client_endpoint_port:                          "19000" => "19000"
      node_type.0.durability_level:                              "Bronze" => "Bronze"
      node_type.0.ephemeral_ports.#:                             "1" => <computed>
      node_type.0.http_endpoint_port:                            "19080" => "19080"
      node_type.0.instance_count:                                "3" => "3"
      node_type.0.is_primary:                                    "true" => "true"
      node_type.0.name:                                          "jdssvm1" => "jdssvm1"
      reliability_level:                                         "Bronze" => "Bronze"
      resource_group_name:                                       "test-rg" => "test-rg"
      tags.%:                                                    "0" => <computed>
      upgrade_mode:                                              "Automatic" => "Automatic"
      vm_image:                                                  "Windows" => "Windows"

  ~ azurerm_virtual_machine_scale_set.scale-set
      extension.1288337054.auto_upgrade_minor_version:           "false" => "false"
      extension.1288337054.name:                                 "ServiceFabricNodeVmExt" => ""
      extension.1288337054.protected_settings:                   "" => ""
      extension.1288337054.publisher:                            "Microsoft.Azure.ServiceFabric" => ""
      extension.1288337054.settings:                             "{\"NicPrefixOverride\":\"10.0.0\",\"certificate\":{\"thumbprint\":\"0000000000000000000000000000000000000000\",\"x509StoreName\":\"My\"},\"clusterEndpoint\":\"https://northeurope.servicefabric.azure.com/runtime/clusters/00000000-0000-0000-0000-000000000000\",\"dataPath\":\"D:\\\\\\\\SvcFab\",\"durabilityLevel\":\"Bronze\",\"nodeTypeRef\":\"jdssvm1\"}" => ""
      extension.1288337054.type:                                 "ServiceFabricNode" => ""
      extension.1288337054.type_handler_version:                 "1.0" => ""
      extension.~2201358812.auto_upgrade_minor_version:          "" => ""
      extension.~2201358812.name:                                "" => "ServiceFabricNodeVmExt"
      extension.~2201358812.protected_settings:                  <sensitive> => <sensitive> (attribute changed)
      extension.~2201358812.publisher:                           "" => "Microsoft.Azure.ServiceFabric"
      extension.~2201358812.settings:                            "" => "      {\n        \"clusterEndpoint\": \"${azurerm_service_fabric_cluster.test.cluster_endpoint}\",\n      \"nodeTypeRef\": \"jdssvm1\",\n        \"dataPath\": \"D:\\\\\\\\SvcFab\",\n        \"durabilityLevel\": \"Bronze\",\n        \"NicPrefixOverride\": \"10.0.0\",\n\"certificate\": {\n          \"thumbprint\": \"0000000000000000000000000000000000000000\",\n          \"x509StoreName\": \"My\"\n        }\n      }\n"
      extension.~2201358812.type:                                "" => "ServiceFabricNode"
      extension.~2201358812.type_handler_version:                "" => "1.0"


Plan: 1 to add, 1 to change, 1 to destroy.

(fixes #2539 )

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

Thanks for this PR :)

Taking a look through this mostly LGTM - if we can fix up the minor issues (and the tests pass 😄) then this should be good to merge 👍

Thanks!

azurerm/resource_arm_service_fabric_cluster_test.go Outdated Show resolved Hide resolved
website/docs/r/service_fabric_cluster.html.markdown Outdated Show resolved Hide resolved
website/docs/r/service_fabric_cluster.html.markdown Outdated Show resolved Hide resolved
website/docs/r/service_fabric_cluster.html.markdown Outdated Show resolved Hide resolved
website/docs/r/service_fabric_cluster.html.markdown Outdated Show resolved Hide resolved
tombuildsstuff and others added 7 commits December 21, 2018 09:52
Co-Authored-By: DenheenJ <39860623+DenheenJ@users.noreply.github.com>
Co-Authored-By: DenheenJ <39860623+DenheenJ@users.noreply.github.com>
Co-Authored-By: DenheenJ <39860623+DenheenJ@users.noreply.github.com>
Co-Authored-By: DenheenJ <39860623+DenheenJ@users.noreply.github.com>
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 @DenheenJ

Thanks for making those changes - this now LGTM 👍

Thanks!

@tombuildsstuff tombuildsstuff added this to the 1.21.0 milestone Dec 22, 2018
@tombuildsstuff
Copy link
Contributor

hey @DenheenJ

I've run the tests for this and whilst the existing tests pass the new one doesn't, from what appears to be a configuration failure - out of interest do we need another configuration option set in the tests for this?

------- Stdout: -------
=== RUN   TestAccAzureRMServiceFabricCluster_azureActiveDirectory
=== PAUSE TestAccAzureRMServiceFabricCluster_azureActiveDirectory
=== CONT  TestAccAzureRMServiceFabricCluster_azureActiveDirectory
--- FAIL: TestAccAzureRMServiceFabricCluster_azureActiveDirectory (63.65s)
	testing.go:538: Step 0 error: Error applying: 1 error(s) occurred:
		
		* azurerm_service_fabric_cluster.test: 1 error(s) occurred:
		
		* azurerm_service_fabric_cluster.test: Error creating Service Fabric Cluster "acctest-7992678191032686551" (Resource Group "acctestRG-7992678191032686551"): servicefabric.ClustersClient#Create: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="PropertyAllowedInSecureClustersOnly" Message="'AzureActiveDirectory' is allowed in secure clusters only." Details=[]
FAIL

Thanks!

@DenheenJ
Copy link
Contributor Author

@tombuildsstuff i managed to reproduce the same failure when a certificate is not included. I have added the certificate to the test file.

@ghost ghost removed the waiting-response label Dec 24, 2018
@katbyte
Copy link
Collaborator

katbyte commented Dec 24, 2018

@DenheenJ,

I have re-run the test and we are now getting this failure on our CI system:

------- Stdout: -------
=== RUN   TestAccAzureRMServiceFabricCluster_azureActiveDirectory
=== PAUSE TestAccAzureRMServiceFabricCluster_azureActiveDirectory
=== CONT  TestAccAzureRMServiceFabricCluster_azureActiveDirectory
--- FAIL: TestAccAzureRMServiceFabricCluster_azureActiveDirectory (63.68s)
	testing.go:538: Step 0 error: Error applying: 1 error(s) occurred:
		
		* azurerm_service_fabric_cluster.test: 1 error(s) occurred:
		
		* azurerm_service_fabric_cluster.test: Error creating Service Fabric Cluster "acctest-1837755086307828162" (Resource Group "acctestRG-1837755086307828162"): servicefabric.ClustersClient#Create: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="ClientCertDefinedWithoutServerCert" Message="Client certificates cannot be defined when cluster certificate is not defined." Details=[]
FAIL

@DenheenJ
Copy link
Contributor Author

sorry i added a holiday typo! should pass the test now.

@ghost ghost removed the waiting-response label Dec 27, 2018
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.

@DenheenJ,

Thanks for the fix, however i believe the test checks need a slight change:

------- Stdout: -------
=== RUN   TestAccAzureRMServiceFabricCluster_azureActiveDirectory
=== PAUSE TestAccAzureRMServiceFabricCluster_azureActiveDirectory
=== CONT  TestAccAzureRMServiceFabricCluster_azureActiveDirectory
--- FAIL: TestAccAzureRMServiceFabricCluster_azureActiveDirectory (72.87s)
	testing.go:538: Step 0 error: Check failed: Check 6/11 error: azurerm_service_fabric_cluster.test: Attribute 'azure_active_directory.tenant_id' not found
FAIL

azurerm/resource_arm_service_fabric_cluster_test.go Outdated Show resolved Hide resolved
azurerm/resource_arm_service_fabric_cluster_test.go Outdated Show resolved Hide resolved
azurerm/resource_arm_service_fabric_cluster_test.go Outdated Show resolved Hide resolved
@katbyte katbyte self-assigned this Dec 27, 2018
katbyte and others added 5 commits December 28, 2018 09:11
Co-Authored-By: DenheenJ <39860623+DenheenJ@users.noreply.github.com>
Co-Authored-By: DenheenJ <39860623+DenheenJ@users.noreply.github.com>
Co-Authored-By: DenheenJ <39860623+DenheenJ@users.noreply.github.com>
@DenheenJ
Copy link
Contributor Author

DenheenJ commented Jan 3, 2019

I've added additional resources to the test to use real resources however the client app still needs to be added manually as i don't think there is a way to do that in Terraform with this provider yet.

@ghost ghost removed the waiting-response label Jan 3, 2019
@tombuildsstuff
Copy link
Contributor

tombuildsstuff commented Jan 3, 2019

hey @DenheenJ

I hope you don't mind but I've pushed a commit to fix the failing test I mentioned above and the tests now pass:

screenshot 2019-01-03 at 11 36 46

Thanks for this @DenheenJ!

@tombuildsstuff tombuildsstuff merged commit cc87acf into hashicorp:master Jan 3, 2019
tombuildsstuff added a commit that referenced this pull request Jan 3, 2019
@DenheenJ
Copy link
Contributor Author

DenheenJ commented Jan 3, 2019

@tombuildsstuff no that's fantastic thank you.

@ghost
Copy link

ghost commented Mar 5, 2019

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 5, 2019
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.

azurerm_service_fabric_cluster support for azure_active_directory
3 participants