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

feat: support record.key entries #17

Merged
merged 1 commit into from
Oct 14, 2022

Conversation

aldoborrero
Copy link
Contributor

What

  • Addition of the possibility of adding an extra key argument to records variable to disambiguate specific scenarios where collisions may occur.
  • Addition of extra - to records key generation to better align with rest of the codebase.

Why

  • Currently, we can't specify records that may produce the same id but with different values like the example below (which are valid ones):
module "test" {
  source  = "cloudposse/zone/cloudflare"
  version = "0.1.2"

  context            = module.test_label.context
  zone                = "example.com"
  zone_enabled = false
  enabled           = true
  records            = [
   {
      name    = "@"
      priority  = 1
      ttl          = 1
      type      = "MX"
      value    = "a.example.com"
    },
    {
      name     = "@"
      priority   = 5
      ttl           = 1
      type       = "MX"
      value     = "b.example.com"
    },
  ]
}

This PR changes this with the addition of a key resource:

module "test" {
  source  = "cloudposse/zone/cloudflare"
  version = "0.1.2"

  context            = module.test_label.context
  zone                = "example.com"
  zone_enabled = false
  enabled           = true
  records            = [
   {
      key        = "@-MX-1"
      name     = "@"
      priority   = 1
      ttl           = 1
      type       = "MX"
      value     = "a.example.com"
    },
    {
      key        = "@-MX-2"
      name     = "@"
      priority   = 5
      ttl           = 1
      type       = "MX"
      value     = "b.example.com"
    },
  ]
}

The key can be applied optionally to the records that needs them. It doesn't force to define one in all records.

References

@aldoborrero aldoborrero requested review from a team as code owners October 11, 2022 10:38
@milldr
Copy link
Member

milldr commented Oct 14, 2022

/test all

Copy link
Member

@milldr milldr left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you for your contribution

@milldr milldr merged commit 0b2bf64 into cloudposse:master Oct 14, 2022
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

Successfully merging this pull request may close these issues.

Improve records interface to allow for multiple records with unique values
2 participants