✨ Add initial Terraform configuration for Azure and Proxmox resources
This commit is contained in:
20
modules/pip/main.tf
Normal file
20
modules/pip/main.tf
Normal file
@@ -0,0 +1,20 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
http = { }
|
||||
}
|
||||
}
|
||||
|
||||
data "http" "echoip" {
|
||||
url = var.http_url
|
||||
request_headers = var.http_request_headers
|
||||
method = var.http_method
|
||||
|
||||
insecure = core::startswith(var.http_url, "http://")
|
||||
|
||||
lifecycle {
|
||||
postcondition {
|
||||
condition = contains([200,201,204], self.status_code)
|
||||
error_message = "Status code ${self.status_code} indicates request failure."
|
||||
}
|
||||
}
|
||||
}
|
||||
4
modules/pip/outputs.tf
Normal file
4
modules/pip/outputs.tf
Normal file
@@ -0,0 +1,4 @@
|
||||
output "ip" {
|
||||
description = "The `ip` field of the echoip response."
|
||||
value = trimspace(data.http.echoip.response_body)
|
||||
}
|
||||
27
modules/pip/variables.tf
Normal file
27
modules/pip/variables.tf
Normal file
@@ -0,0 +1,27 @@
|
||||
variable "http_url" {
|
||||
description = "URL for echoip service to use."
|
||||
type = string
|
||||
|
||||
default = "https://checkip.amazonaws.com"
|
||||
|
||||
validation {
|
||||
condition = can(regex("https?://", var.http_url))
|
||||
error_message = "The `http_url` variable must start either http:// or https://"
|
||||
}
|
||||
}
|
||||
|
||||
variable "http_request_headers" {
|
||||
description = "HTTP headers to send with the request"
|
||||
type = map(any)
|
||||
|
||||
default = {
|
||||
Accept = "application/json"
|
||||
}
|
||||
}
|
||||
|
||||
variable "http_method" {
|
||||
description = "HTTP method to use for the request"
|
||||
type = string
|
||||
|
||||
default = "GET"
|
||||
}
|
||||
Reference in New Issue
Block a user