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 data_source for Active Directory #15

Closed
okrause opened this issue Aug 27, 2020 · 2 comments
Closed

Add data_source for Active Directory #15

okrause opened this issue Aug 27, 2020 · 2 comments

Comments

@okrause
Copy link
Contributor

okrause commented Aug 27, 2020

Use case

To be able to successfully create a SMB volume, an Active Directory configuration needs to be present for the region of interest. No AD, no SMB volume.

Therefore it makes sense to use the *depends_on" meta-argument of Terraform to establish a dependency of the SMB volume to an AD configuration.

Currently, this can be done if the AD configuration is also create and managed by TF and the modules have access to this TF configuration.

The more common case is, that the AD configuration was created manually or via another TF module which cannot easily be referenced.

Having an Active Directory data_source which can be used to query the existing AD configuration for the intended region would allow to make this AD configuration "known" to TF and would create an resource which the SMB volume can depend on.

Example code:

# Specify the provider and access details
locals {
  gcp_project = "1234567890"
  gcp_service_account = "/Users/test/cvs-admin-sa.json"
  network = "default"
  volume_name = "tftest"
  region = "europe-west3"
  size = 1024
  service_level = "standard"
}

terraform {
  required_version = ">= 0.13"
  required_providers {
    netapp-gcp = {
      source = "NetApp/netapp-gcp"
    }
  }
}

provider "netapp-gcp" {
  project         = local.gcp_project
  service_account = local.gcp_service_account
}

data "netapp-gcp_active_directory" "ad-west3" {
    # domain = "example.com"
    region = local.region
}

resource "netapp-gcp_volume" "gcp-smb-volume" {
  provider = netapp-gcp
  name = local.volume_name
  region = local.region
  protocol_types = ["SMB"]
  network = local.network
  size = local.size
  service_level = local.service_level
  depends_on = [
    data.netapp-gcp_active_directory.ad-west3
  ]
}
@wenjun666
Copy link
Contributor

yes, we will add data_source for Active Directory.

@okrause
Copy link
Contributor Author

okrause commented Sep 23, 2020

5f2a596 and a1914cb added AD data source. I verified it for some use cases. Looks good. Thank you!

I modified my example files to make use of it. We need to talk when to include it. Now, or when the new functionality is available in the provider at the hashicorp repo. But this is not a discussion for this issue, this is done. Closing this one.

@okrause okrause closed this as completed Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants