ns1-terraform / terraform-provider-ns1

Terraform NS1 provider
https://www.terraform.io/docs/providers/ns1/
Mozilla Public License 2.0
31 stars 63 forks source link

ns1_record regions seem unordered, undeterministic, cannot reliably run #19

Closed stephengroat closed 5 years ago

stephengroat commented 6 years ago

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Terraform v0.11.2
+ provider.ns1 v1.0.0

Affected Resource(s)

Please list the resources as a list, for example:

Terraform Configuration Files

module "tags_com" {
  zone   = "zone"
  domain = "tags.zone"
  type = "CNAME"
  ttl    = "600"

  answers = [
    {
      answer = "tags.edgekey.net"
      region = "Tier-II"

      meta = {
        note     = "Akamai"
        priority = "1"
        up       = "1"
      }
    },
  ]

  regions = [
    {
      name = "Tier-II"

      meta = {
        country = "BD,BF,BN,BO,JP,BI,BJ,BT,BV,BW,BR,RW,RE,LR,GW,GS,GQ,BH,GY,GF,GE,GA,GN,GM,KW,GH,OM,JO,HM,PS,PY,KP,PE,PK,PH,ZM,EH,EG,ZA,EC,AO,ET,ZW,ER,MG,UY,UZ,MM,ML,MO,MN,MU,MW,MV,MR,UG,MY,MZ,FK,NA,NE,NG,NP,CI,CO,CM,CL,CC,CG,CF,CD,CY,CX,MA,CV,SZ,SY,KG,KE,SR,KH,KM,ST,KR,SH,SO,SN,SL,SC,KZ,SA,SG,SD,DJ,YE,DZ,YT,LB,LA,TW,TR,LK,TN,TL,TM,TJ,LS,TH,TF,TG,TD,LY,AE,VE,AF,IQ,IR,AM,VN,AR,IL,IO,TZ,AZ,ID,QA"
      }
    },
    {
      name = "Cedexis"

      meta = {
        country = "BE,FR,BG,BA,HR,BM,DE,HU,US,UM,FI,SJ,JE,BY,FO,RU,NL,PT,RS,LT,NF,LI,LV,NZ,LU,GI,RO,CA,PL,PM,VA,CH,GR,EE,IS,AL,IT,GG,CZ,AU,AT,AX,AD,GL,IE,ES,ME,MD,MC,NO,MK,SK,MT,SI,SM,DK,IM,UA,SE,GB"
      }
    },
    {
      name = "EdgeCast-China"

      meta = {
        country = "CN"
      }
    },
    {
      name = "India"

      meta = {
        country = "IN"
      }
    },
    {
      name = "CatchAll"
      meta = {}
    },
  ]
}

Expected Behavior

terraform plan should be a repeatable function (as long the regions of the ns1_record in question are not changing in the background)

Actual Behavior

terraform plan for ns1_record with regions does not appear to be a repeatable/reliable function, regions in the list seems to switch positions all the time

Steps to Reproduce

terraform plan terraform plan

stephengroat commented 6 years ago

@markmpeterson saw that you cut the last release, any way you could help with this issue?

bparli commented 5 years ago

It looked like @alistanis was working on this already. Any chance a fix could get released sometime?

kornface13 commented 5 years ago

I'm having this same issue: Terraform will perform the following actions:

~ ns1_record.convos_etsy_com_MX regions.0.name: "mj" => "sg" regions.1.name: "sg" => "mj"

It will continually just flip flop the region names and TF cannot run without thinking changes have been made.

rupa commented 5 years ago

Can confirm this is still an issue with latest version of provider

rupa commented 5 years ago

The best way to deal with this currently is to to keep the regions ordered by name in your .tf files. This should keep terraform from flipping them around.

This was documented already, but I pushed a patch to emphasize this requirement a bit more in the docs.

Feel free to reopen or make a new ticket if this workaround is not acceptable, so we can understand the use case, etc.