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

Plan without changes shows changes from time to time #22

Open
PashaZinchenko opened this issue Sep 27, 2022 · 0 comments
Open

Plan without changes shows changes from time to time #22

PashaZinchenko opened this issue Sep 27, 2022 · 0 comments

Comments

@PashaZinchenko
Copy link

Hi!

If you create alert contact with type web-hook and run terraform plan command (without changes in code) - it could identify changes like "type: web-hook -> webhook". Even if you apply the changes, next time it could randomly identify the similar changes, but in back "type: webhook -> web-hook". And so on in circle.

FIrst plan

$> terraform plan -var-file=terrafrom.tfvars
data.uptimerobot_account.main: Reading...
uptimerobot_alert_contact.contact_opsgenie_tf: Refreshing state... [id=3543745]
uptimerobot_monitor.website: Refreshing state... [id=792576137]
data.uptimerobot_account.main: Read complete after 0s [id=2022-09-27 07:01:30.376437681 +0000 UTC]


Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # uptimerobot_alert_contact.contact_opsgenie_tf must be replaced
-/+ resource "uptimerobot_alert_contact" "contact_opsgenie_tf" {
      ~ id            = "3543745" -> (known after apply)
      ~ status        = "active" -> (known after apply)
      ~ type          = "web-hook" -> "webhook" # forces replacement
        # (2 unchanged attributes hidden)
    }

  # uptimerobot_monitor.website will be updated in-place
  ~ resource "uptimerobot_monitor" "website" {
        id                  = "792576137"
        # (9 unchanged attributes hidden)

      - alert_contact {
          - id         = "3543745" -> null
          - recurrence = 10 -> null
          - threshold  = 5 -> null
        }
      + alert_contact {
          + id         = (known after apply)
          + recurrence = 10
          + threshold  = 5
        }
    }

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

Second plan

$> terraform plan -var-file=terrafrom.tfvars
data.uptimerobot_account.main: Reading...
uptimerobot_alert_contact.contact_opsgenie_tf: Refreshing state... [id=3543745]
uptimerobot_monitor.website: Refreshing state... [id=792576137]
data.uptimerobot_account.main: Read complete after 0s [id=2022-09-27 07:01:30.376437681 +0000 UTC]

No changes. Your infrastructure matches the configuration.

Third plan

$> terraform plan -var-file=terrafrom.tfvars
data.uptimerobot_account.main: Reading...
uptimerobot_alert_contact.contact_opsgenie_tf: Refreshing state... [id=3543745]
uptimerobot_monitor.website: Refreshing state... [id=792576137]
data.uptimerobot_account.main: Read complete after 0s [id=2022-09-27 07:11:51.098401729 +0000 UTC]


Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # uptimerobot_alert_contact.contact_opsgenie_tf must be replaced
-/+ resource "uptimerobot_alert_contact" "contact_opsgenie_tf" {
      ~ id            = "3543745" -> (known after apply)
      ~ status        = "active" -> (known after apply)
      ~ type          = "web-hook" -> "webhook" # forces replacement
        # (2 unchanged attributes hidden)
    }

  # uptimerobot_monitor.website will be updated in-place
  ~ resource "uptimerobot_monitor" "website" {
        id                  = "792576137"
        # (9 unchanged attributes hidden)

      - alert_contact {
          - id         = "3543745" -> null
          - recurrence = 10 -> null
          - threshold  = 5 -> null
        }
      + alert_contact {
          + id         = (known after apply)
          + recurrence = 10
          + threshold  = 5
        }
    }

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

I assumed that problem here

var alertContactType = map[string]int{
"sms": 1,
"e-mail": 2,
"twitter": 3,
"twitter-dm": 3,
"boxcar": 4,
"web-hook": 5,
"webhook": 5,
"pushbullet": 6,
"zapier": 7,
"pro-sms": 8,
"pushover": 9,
"slack": 11,
"voice-call": 14,
"splunk": 15,
"pagerduty": 16,
"opsgenie": 17,
"telegram": 18,
"ms-teams": 20,
"google-chat": 21,
"hangouts": 21,
"discord": 23,
}

on the 19-20 lines, so I have removed webhook value and left only web-hook value, built the binary, added my binary instead of yours and did plan about 15 times - no random changes!

Just in case a little bit about system:

$> go version
go version go1.19.1 linux/amd64

$> terraform version
Terraform v1.3.0
on linux_amd64
+ provider registry.terraform.io/vexxhost/uptimerobot v0.8.2

 $> uname --kernel-name --kernel-release
Linux 5.4.0-126-generic

 $> cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.5 LTS"

Could you please take a look and fix this bug?

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

1 participant