Closed cirojas-spaceiq closed 1 year ago
Can you provide minimal configuration to reproduce that please?
Are you sure API token is propagated properly to your pipeline agent?
The pipeline API token is working properly provided that the terraform plan
is running.
The module I have for this is the following:
terraform {
required_providers {
uptime = {
source = "uptime-com/uptime"
version = "~> 2.0"
}
}
}
provider "uptime" {
token = var.uptime_token
}
resource "uptime_check_http" "http" {
name = var.name
interval = var.interval
address = var.address
contact_groups = var.contact_groups
locations = var.locations
tags = var.tags
username = var.username
password = var.password
send_string = var.send_string
expect_string = var.expect_string
proxy = var.proxy
status_code = var.status_code
lifecycle {
ignore_changes = [
encryption, headers
]
}
}
resource "null_resource" "encryption" {
depends_on = [uptime_check_http.http]
triggers = {
value = var.encryption
}
provisioner "local-exec" {
command = <<-EOT
curl --location --request PATCH 'https://uptime.com/api/v1/checks/${uptime_check_http.http.id}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token ${var.uptime_token}' \
--data '{
"msp_encryption": "${var.encryption?"SSL_TLS":""}"
}'
EOT
}
}
resource "null_resource" "headers" {
depends_on = [uptime_check_http.http]
triggers = {
value = var.headers
}
provisioner "local-exec" {
command = <<-EOT
curl --location --request PATCH 'https://uptime.com/api/v1/checks/${uptime_check_http.http.id}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token ${var.uptime_token}' \
--data '{
"msp_headers": "${var.headers}"
}'
EOT
}
}
variable "uptime_token" {
type = string
sensitive = true
}
variable "name" {
type = string
}
variable "address" {
type = string
}
variable "interval" {
type = number
}
variable "contact_groups" {
type = set(string)
}
variable "locations" {
type = set(string)
}
variable "tags" {
type = set(string)
}
variable "username" {
type = string
default = null
}
variable "password" {
type = string
default = null
}
variable "send_string" {
type = string
default = null
}
variable "expect_string" {
type = string
default = null
}
variable "proxy" {
type = string
default = null
}
variable "encryption" {
type = bool
default = false
}
variable "status_code" {
type = string
}
variable "headers" {
type = string
default = ""
}
The failure is during terraform apply
only, I'm sure I'm passing the token correctly because the terraform plan
is working as expected.
I had a misconfiguration in the pipeline, closing the issue.
I'm getting errors when uptime modules are invoked from pipeline agents, running locally it works out as expected. The plan is executed it successfully, however on Terraform Apply I got this:
Terragrunt Plan
I'm using the same uptime token for the plan and apply