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

plugins: include add github.com/abhinavdahiya/terraform-provider-azurerm-srv #1737

Closed
wants to merge 2 commits into from

Conversation

abhinavdahiya
Copy link
Contributor

This plugin 1 is almost same upstream azurerm provider 2, with the only exception that the
record field is a TypeList compared to TypeSet for dns_srv_record resource.

The TypeList allows users to create the list of records in the SRV record dynamically, which is not possible with upstream unless
we wait for terraform 0.12 to become generally available with foreach semanctics and all our other vendored plugins have also moved to 0.12
compatibility.

This allows users to create SRV record like

provider "azurerm" {}
provider "azurerm-srv" {}

resource "azurerm_resource_group" "main" {
  name     = "example"
  location = "westus2"
}

resource "azurerm_virtual_network" "main" {
  name                = "example"
  resource_group_name = "${azurerm_resource_group.main.name}"
  location            = "westus2"
  address_space       = ["10.0.0.0/16"]
}

resource "azurerm_dns_zone" "private" {
  name                           = "thisistest.com"
  resource_group_name            = "${azurerm_resource_group.main.name}"
  zone_type                      = "Private"
  resolution_virtual_network_ids = ["${azurerm_virtual_network.main.id}"]
}

resource "null_resource" "etcd_mappings" {
  count = 4

  triggers {
    priority = 10
    weight   = 10
    port     = 2380
    target   = "etcd-${count.index}.${azurerm_dns_zone.private.name}"
  }
}

resource "azurerm-srv_dns_srv_record" "etcd_cluster" {
  name                = "_etcd-server-ssl._tcp"
  zone_name           = "${azurerm_dns_zone.private.name}"
  resource_group_name = "${azurerm_resource_group.main.name}"
  ttl                 = 60

  record = ["${null_resource.etcd_mappings.*.triggers}"]
}

This was created from offline discussion with @serbrech who is working on azure initial support, especially https://github.com/openshift/installer/pull/1454/files#diff-764adb23dcc0edbbebc09192eb233e9aR41 which hardcodes the number of masters because of the upstream's inability.

Since terraform 0.12 is going to be released soon, the upstream is moving users to foreach.
the installer can only move to 0.12 after it is generally available, all plugins have moved to newer codebase (currently ignition, libvirt are trailing) and we have done the internal work to make changes to our terraform templates based on https://www.terraform.io/upgrade-guides/0-12.html.

Therefore moving to 0.12 is going to be a lot of work and this lightweight plugin should help us move ahead on azure without all that effort.

@openshift-ci-robot openshift-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label May 10, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavdahiya

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 10, 2019
…erm-srv

This plugin [1] is almost same upstream azurerm provider [2], with the only exception that the
`record` field is a `TypeList` compared to `TypeSet` for `dns_srv_record` resource.

The `TypeList` allows users to create the list of records in the SRV record dynamically, which is not possible with upstream unless
we wait for `terraform 0.12` to become generally available with `foreach` semanctics and all our other vendored plugins have also moved to 0.12
compatibility.

This allows users to create SRV record  like

```tf
provider "azurerm" {}
provider "azurerm-srv" {}

resource "azurerm_resource_group" "main" {
  name     = "example"
  location = "westus2"
}

resource "azurerm_virtual_network" "main" {
  name                = "example"
  resource_group_name = "${azurerm_resource_group.main.name}"
  location            = "westus2"
  address_space       = ["10.0.0.0/16"]
}

resource "azurerm_dns_zone" "private" {
  name                           = "thisistest.com"
  resource_group_name            = "${azurerm_resource_group.main.name}"
  zone_type                      = "Private"
  resolution_virtual_network_ids = ["${azurerm_virtual_network.main.id}"]
}

resource "null_resource" "etcd_mappings" {
  count = 4

  triggers {
    priority = 10
    weight   = 10
    port     = 2380
    target   = "etcd-${count.index}.${azurerm_dns_zone.private.name}"
  }
}

resource "azurerm-srv_dns_srv_record" "etcd_cluster" {
  name                = "_etcd-server-ssl._tcp"
  zone_name           = "${azurerm_dns_zone.private.name}"
  resource_group_name = "${azurerm_resource_group.main.name}"
  ttl                 = 60

  record = ["${null_resource.etcd_mappings.*.triggers}"]
}
```
[1]: https://github.com/abhinavdahiya/terraform-provider-azurerm-srv
[2]: https://github.com/terraform-providers/terraform-provider-azurerm
@abhinavdahiya
Copy link
Contributor Author

abhinavdahiya commented May 10, 2019

/cc @wking @crawford @staebler

This can be an alternative to forking azurerm provider for the change we want untill we move to 0.12.

@trown
Copy link

trown commented May 10, 2019

/test e2e-openstack

@abhinavdahiya
Copy link
Contributor Author

/hold

^^ i forgot that
need to discuss and come to conclusion before committing to it.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 10, 2019
@abhinavdahiya
Copy link
Contributor Author

/close

looks like 0.12 would be the move forward. #1739

@openshift-ci-robot
Copy link
Contributor

@abhinavdahiya: Closed this PR.

In response to this:

/close

looks like 0.12 would be the move forward. #1739

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot
Copy link
Contributor

@abhinavdahiya: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-aws bb970f5 link /test e2e-aws

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@abhinavdahiya abhinavdahiya deleted the azure-srv branch May 22, 2019 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants