statuscakedev / terraform-provider-statuscake Goto Github PK
View Code? Open in Web Editor NEWTerraform StatusCake provider
Home Page: https://registry.terraform.io/providers/StatusCakeDev/statuscake/
License: Mozilla Public License 2.0
Terraform StatusCake provider
Home Page: https://registry.terraform.io/providers/StatusCakeDev/statuscake/
License: Mozilla Public License 2.0
The argument contact_group
on the statuscake_test
resource accepts a list. Also the statuscake API behind contact groups is /ContactGroups
.
Wouldn't it be nice to rename this argument to contact_groups
instead?
I know this will create non-backward compatible changes but if the change is made in a provider version bump we can support the old contact_group
argument for one or two versions with a deprecation warning.
What do you think?
Describe the bug
Error while applying creation resource of type statuscake_uptime_check
The resource is successfully created (can be seen in statuscake web interface) but an error is thrown after creation and nothing is added to the terraform.tfstate
module.statuscake.statuscake_uptime_check.example_com: Creating...
╷
│ Error: Request cancelled
│
│ with module.statuscake.statuscake_uptime_check.example_com,
│ on statuscake/statuscake_tests.tf line 1, in resource "statuscake_uptime_check" "example_com":
│ 1: resource "statuscake_uptime_check" "example_com" {
│
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵
Stack trace from the terraform-provider-statuscake_v2.0.0 plugin:
panic: reflect: call of reflect.Value.Interface on zero Value
goroutine 27 [running]:
reflect.valueInterface({0x0, 0x0, 0x40d247}, 0x8)
reflect/value.go:1369 +0x10e
reflect.Value.Interface(...)
reflect/value.go:1364
github.com/StatusCakeDev/terraform-provider-statuscake/internal/provider.stringElem({0xb17f80, 0x0})
github.com/StatusCakeDev/terraform-provider-statuscake/internal/provider/utils.go:37 +0xbe
github.com/StatusCakeDev/terraform-provider-statuscake/internal/provider.flattenUptimeCheckRequestHeaders({0xb17f80, 0x0}, 0xc42bd8)
github.com/StatusCakeDev/terraform-provider-statuscake/internal/provider/resource_uptime_check.go:1114 +0x45
github.com/StatusCakeDev/terraform-provider-statuscake/internal/provider.flattenUptimeCheckHTTPCheck({0xc30740, 0xc0001b6e20}, 0x9)
github.com/StatusCakeDev/terraform-provider-statuscake/internal/provider/resource_uptime_check.go:964 +0x5be
github.com/StatusCakeDev/terraform-provider-statuscake/internal/provider.resourceStatusCakeUptimeCheckRead({0xd4d4a8, 0xc000618b40}, 0xc000402e00, {0xc353a0, 0xc0004a4780})
github.com/StatusCakeDev/terraform-provider-statuscake/internal/provider/resource_uptime_check.go:505 +0xad5
github.com/StatusCakeDev/terraform-provider-statuscake/internal/provider.resourceStatusCakeUptimeCheckCreate({0xd4d4a8, 0xc000618b40}, 0xc0001b7668, {0xc353a0, 0xc0004a4780})
github.com/StatusCakeDev/terraform-provider-statuscake/internal/provider/resource_uptime_check.go:471 +0xe66
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc00029d420, {0xd4d438, 0xc0003f6440}, 0x2, {0xc353a0, 0xc0004a4780})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:341 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00029d420, {0xd4d438, 0xc0003f6440}, 0xc000430dd0, 0xc000402c80, {0xc353a0, 0xc0004a4780})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:467 +0x871
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0002907c8, {0xd4d438, 0xc0003f6440}, 0xc00042a640)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:977 +0xd8a
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000328be0, {0xd4d4e0, 0xc0003fa1e0}, 0xc000506000)
github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:810 +0x5eb
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xc0d560, 0xc000328be0}, {0xd4d4e0, 0xc0003fa1e0}, 0xc000618180, 0x0)
github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002ae700, {0xd5a810, 0xc00040c1a0}, 0xc000012000, 0xc0003d10b0, 0x12565e0, 0x0)
google.golang.org/[email protected]/server.go:1282 +0xccf
google.golang.org/grpc.(*Server).handleStream(0xc0002ae700, {0xd5a810, 0xc00040c1a0}, 0xc000012000, 0x0)
google.golang.org/[email protected]/server.go:1616 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
google.golang.org/[email protected]/server.go:921 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/[email protected]/server.go:919 +0x294
Error: The terraform-provider-statuscake_v2.0.0 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
statuscake_uptime_check deployed with no errors and added to terraform.tfstate
Additional context
Trying to test the provider, tell me if you need more details
Hi there,
the provider should support Contact groups and Integrations to avoid UI usage by using for example integration IDs as outputs from the TF PagerDuty provider. I know that the StatusCake API V1 does not support Integrations yet, but I did not find out myself how I could report a feature request for the StatusCake API. Does anybody know that?
StatusCake seems to be loosing competition battle in this area: UptimeRobot API supports the full cycle of creating uptime tests connected to the alert contacts. PagerDuty support was added recently to their API, so I suppose that their TF provider will add it soon too.
P.S. I know that there is good alternative TF provider implementation for StatusCake , which is blocked on the lack of API endpoint for the Integrations too.
As part of the preparation for Terraform v0.12, we would like to migrate all providers to use Go Modules. We plan to continue checking dependencies into vendor/ to remain compatible with existing tooling/CI for a period of time, however go modules will be used for management. Go Modules is the official solution for the go programming language, we understand some providers might not want this change yet, however we encourage providers to begin looking towards the switch as this is how we will be managing all Go projects in the future. Would maintainers please react with 👍 for support, or 👎 if you wish to have this provider omitted from the first wave of pull requests. If your provider is in support, we would ask that you avoid merging any pull requests that mutate the dependencies while the Go Modules PR is open (in fact a total codefreeze would be even more helpful), otherwise we will need to close that PR and re-run go mod init
. Once merged, dependencies can be added or updated as follows:
$ GO111MODULE=on go get github.com/some/module@master
$ GO111MODULE=on go mod tidy
$ GO111MODULE=on go mod vendor
GO111MODULE=on might be unnecessary depending on your environment, this example will fetch a module @ master and record it in your project's go.mod and go.sum files. It's a good idea to tidy up afterward and then copy the dependencies into vendor/. To remove dependencies from your project, simply remove all usage from your codebase and run:
$ GO111MODULE=on go mody tidy
$ GO111MODULE=on go mod vendor
Thank you sincerely for all your time, contributions, and cooperation!
Is your feature request related to a problem? Please describe.
Contact groups are used across repositories. It would be useful if we can use a data source to get the contact group so that we can validate we have the right contact group.
Describe the solution you'd like
A data resource for statuscake_contact_group, which mirrors the statuscake_contact_group resource.
Describe alternatives you've considered
Terraform v0.11.7
+ provider.statuscake v0.2.0
Thanks for all the additional options added in v0.2.0 of this provider! 😄
I'd love to also see support for the 'Validate SSL' option:
Describe the bug
When trying to use the latest release as a package the following error occurs:
require github.com/StatusCakeDev/terraform-provider-statuscake: version "v2.0.2-pre" invalid: should be v0 or v1, not v2
To Reproduce
Steps to reproduce the behavior:
require github.com/StatusCakeDev/terraform-provider-statuscake v2.0.2-pre
go mod tidy
Expected behavior
Successfully required!
Desktop (please complete the following information):
Pull request forthcoming 😄
$ terraform -v
Terraform v0.10.2
These are the only configuration files in my case ..
statuscake-var-defs.tf
variable "status_cake_username" {}
variable "status_cake_api_key" {}
variable "status_cake_contact_id" {
default = "12345"
}
statuscake-provider-def.tf
provider "statuscake" {
username = "${var.status_cake_username}"
apikey = "${var.status_cake_api_key}"
}
statuscake-tests.tf
resource "statuscake_test" "api_test_one" {
website_name = "an_example_api_test"
website_url = "www.google.com"
test_type = "HTTP"
check_rate = 300
paused = 0
timeout = 20
contact_id = "${var.status_cake_contact_id}"
}
https://gist.github.com/vmadman/022ea5af347e7d3160cb6afff0a15c98
n/a
Terraform should have produced a plan that, if applied, would create a "test" in StatusCake.
I received an error in the console and in the execution log above.
Error asking for user input: 1 error(s) occurred:
* provider.statuscake: plugin exited before we could connect
terraform init \
-var "status_cake_username=<<skuser>>" \
-var "status_cake_api_key=<<skapikey>>" \
-var "status_cake_contact_id=<<skcontact>>" \
"/path/to/project/terraform/resources"
.. then ..
export TF_LOG="DEBUG"
export TF_LOG_PATH="/path/to/project/terraform/logs/terraform-debug.log"
terraform plan \
-var "status_cake_username=<<skuser>>" \
-var "status_cake_api_key=<<skapikey>>" \
-var "status_cake_contact_id=<<skcontact>>" \
-state="/path/to/project/terraform/state/default-primary.tfstate" \
-out="/path/to/project/terraform/plans/default-primary.tfplan" \
"/path/to/project/terraform/resources"
n/a
none known
Describe the bug
Invalid regions crash the provider without an informative message
To Reproduce
Steps to reproduce the behavior:
resource "statuscake_uptime_check" "debug" {
name = "[DEBUG] THIS IS A TEST"
check_interval = 30
regions = [
"invalid",
]
monitored_resource {
address = "https://google.com"
}
http_check {
request_method = "HTTP"
status_codes = [
"500"
]
}
}
╷
│ Error: failed to create uptime test: The provided parameters are invalid. Check the errors output for detailed information.
│
│ with statuscake_uptime_check.debug,
│ on foo.tf line 18, in resource "statuscake_uptime_check" "debug":
│ 18: resource "statuscake_uptime_check" "debug" {
│
https://gist.github.com/marceloboeira/89c5ed85fbed1f5ea76edee3434d08fa#file-main-tf
Here is the full error log and failing test case:
https://gist.github.com/marceloboeira/89c5ed85fbed1f5ea76edee3434d08fa
Expected behavior
Error on plan (or even apply) with the information that the error is caused by the wrong region code (or any possible message the API is returning for failure).
Additional context
By removing the region's block OR using valid regions, the code works; it just took me a long time to debug and find out that the problem was the region...
Current StatusCake test configuration only supports one contact_id
. Statuscake has updated their API to accept a list of contact IDs provided as a string, separating each contact ID with a comma. Terraform should update accordingly.
Please refer to the documentation at: https://www.statuscake.com/api/Tests/Updating%20Inserting%20and%20Deleting%20Tests.md
Describe the bug
The terraform plan randomly fails with the following error
│ Error: failed to get uptime test with ID:
│
│ with statuscake_uptime_check.proxy["e7bc74d659a3166f"],
│ on monitoring.tf line 26, in resource "statuscake_uptime_check" "proxy":
│ 26: resource "statuscake_uptime_check" "proxy" {
A DEBUG plan only adds the following
2022-09-26T10:22:25.327Z [ERROR] vertex "statuscake_uptime_check.proxy" error: failed to get uptime test with ID:
To Reproduce
Run TF plan multiple times until the error happens.
Expected behavior
Plan consistently succeeds.
Additional context
Using latest version 2.0.4
Is your feature request related to a problem? Please describe.
I'm mostly wondering why changing the address
causes Terraform to want to destroy and recreate a monitor in StatusCake. In my case I'm using http_checks
on the statuscake_uptime_check
resource. If I got into the StatusCake UI I can change the URL of the check without a problem so it seems like the Terraform provider should be able to accomplish the same without recreating the whole check and, presumably, loosing the history associated with the check.
Describe the solution you'd like
It would be best if the URL could be updated in place.
Describe alternatives you've considered
I'm not sure what other solutions inside Terraform there would be. Right now as a workaround I manually update the URL in the UI and then rerun the plan in Terraform but this kinda defeats the purpose of Terraform managing these resources.
Additional context
Add any other context or screenshots about the feature request here.
Please explain to to create dns tests.
I can not find arguments for Expected IP and DNS Server IP.
Terraform v0.11.7
+ provider.statuscake v0.2.0
v0.2.0 of this provider added support for the follow_redirect
option, which by default Terraform sets to false
:
The StatusCake UI however, when creating a new test, has this option on by default:
For consistency between Terraform and the UI, I'd suggest it would be good to use the same defaults where possible. For me, this manifested in diffs upon upgrading from v0.1.0 of the provider to v0.2.0, because my previous tests were implicitly created with 'follow redirects' turned on.
v0.13.5
StatusCake provider
n/a
What should have happened?
Error: Failed to install provider
Error while installing -/statuscake v1.0.0: provider
registry.terraform.io/-/statuscake 1.0.0 is not available for linux_arm64
Run a terraform init on a project with a statuscake provider, but on an ARM64 machine, such as a raspberry pi 4
The issue: when you remove the test manually from the UI, the provider instead of removing this in plan, just resetting all resource parameters. Eventually it must completely remove the resource, so you can add the fresh one instead.
The StatusCake API includes support for CRUD of the Pagespeed tests.
https://www.statuscake.com/api/Page%20Speed/Create%20Pagespeed%20Test.md
https://www.statuscake.com/api/Page%20Speed/Delete%20Pagespeed%20Test.md
https://www.statuscake.com/api/Page%20Speed/Update%20Pagespeed%20Test.md
https://www.statuscake.com/api/Page%20Speed/List%20Pagespeed%20Test.md
It would be nice to add this to the Statuscake provider. Corresponding request opened in the statuscake client library that this provider uses: DreamItGetIT/statuscake#49
Provider currently does not work with Terraform 0.12.
$ terraform init
Initializing the backend...
Successfully configured the backend "gcs"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Checking for available provider plugins...
No available provider "statuscake" plugins are compatible with this Terraform version.
From time to time, new Terraform major releases can change the requirements for
plugins such that older plugins become incompatible.
Terraform checked all of the plugin versions matching the given constraint:
(any version)
Unfortunately, none of the suitable versions are compatible with this version
of Terraform. If you have recently upgraded Terraform, it may be necessary to
move to a newer major release of this provider. Alternatively, if you are
attempting to upgrade the provider to a new major version you may need to
also upgrade Terraform to support the new version.
Consult the documentation for this provider for more information on
compatibility between provider versions and Terraform versions.
Error: no available version is compatible with this version of Terraform
It would be great if we could also configure SSL tests with this provider
Describe the bug
The var statuscake_custom_endpoint seems to not be optional in provider configuration whereas the documentation say it is
To Reproduce
Use the provider as in the doc examples, with only api_token in the provider configuration
Expected behavior
No need to set statuscake_custom_endpoint, the default var should be "https://api.statuscake.com/" I think,
Additional context
Thanks for your job with the 2.x which seems to be have more functionalities and flexibility
Terraform v0.14.6
+ provider registry.terraform.io/terraform-providers/statuscake v1.0.0
Please list the resources as a list, for example:
statuscake_test
resource "statuscake_test" "django" {
check_rate = 60
confirmations = 0
contact_group = [
"121431",
]
do_not_find = false
enable_ssl_alert = true
final_endpoint = "https://test.example.com/"
follow_redirect = true
id = "1235321"
node_locations = []
paused = false
port = 0
status = "Up"
test_id = "1235321"
test_tags = [
"django",
]
test_type = "HTTP"
timeout = 40
trigger_rate = 5
uptime = 0
use_jar = 0
website_name = "test.example.com"
website_url = "test.example.com"
}
Test should be created in first apply run, secon run should not perform an changes.
# terraform apply -target 'module.hatch-test-example-com.statuscake_test.django[0]'
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# module.hatch-test-example-com.statuscake_test.django[0] will be created
+ resource "statuscake_test" "django" {
+ check_rate = 60
+ contact_group = [
+ "121431",
]
+ enable_ssl_alert = true
+ final_endpoint = "https://test.example.com/"
+ follow_redirect = true
+ id = (known after apply)
+ paused = false
+ status = (known after apply)
+ test_id = (known after apply)
+ test_tags = [
+ "django",
]
+ test_type = "HTTP"
+ timeout = 40
+ trigger_rate = 5
+ uptime = (known after apply)
+ website_name = "test.example.com"
+ website_url = "test.example.com"
}
Plan: 1 to add, 0 to change, 0 to destroy.
Warning: Resource targeting is in effect
You are creating a plan with the -target option, which means that the result
of this plan may not represent all of the changes requested by the current
configuration.
The -target option is not for routine use, and is provided only for
exceptional situations such as recovering from errors or mistakes, or when
Terraform specifically suggests to use it as part of an error message.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
module.hatch-test-example-com.statuscake_test.django[0]: Creating...
module.hatch-test-example-com.statuscake_test.django[0]: Creation complete after 1s [id=1235325]
Warning: Applied changes may be incomplete
The plan was created with the -target option in effect, so some changes
requested in the configuration may have been ignored and the output values may
not be fully updated. Run the following command to verify that no other
changes are pending:
terraform plan
Note that the -target option is not suitable for routine use, and is provided
only for exceptional situations such as recovering from errors or mistakes, or
when Terraform specifically suggests to use it as part of an error message.
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
6aa012f6d6a3:~/project/terraform# terraform apply -target 'module.hatch-test-example-com.statuscake_test.django[0]'
module.hatch-test-example-com.statuscake_test.django[0]: Refreshing state... [id=1235325]
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# module.hatch-test-example-com.statuscake_test.django[0] will be updated in-place
~ resource "statuscake_test" "django" {
~ enable_ssl_alert = false -> true
id = "1235325"
# (19 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Warning: Resource targeting is in effect
You are creating a plan with the -target option, which means that the result
of this plan may not represent all of the changes requested by the current
configuration.
The -target option is not for routine use, and is provided only for
exceptional situations such as recovering from errors or mistakes, or when
Terraform specifically suggests to use it as part of an error message.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
module.hatch-test-example-com.statuscake_test.django[0]: Modifying... [id=1235325]
Warning: Applied changes may be incomplete
The plan was created with the -target option in effect, so some changes
requested in the configuration may have been ignored and the output values may
not be fully updated. Run the following command to verify that no other
changes are pending:
terraform plan
Note that the -target option is not suitable for routine use, and is provided
only for exceptional situations such as recovering from errors or mistakes, or
when Terraform specifically suggests to use it as part of an error message.
Error: Error Updating StatusCake Test: No data has been updated (is any data different?)
on modules/heroku_django_app/main.tf line 82, in resource "statuscake_test" "django":
82: resource "statuscake_test" "django" {
It would be very helpful if this provider included a data source for test server locations, similar to the cloudflare_ip_ranges CloudFlare provider data source. Use cases:
node_locations
for statuscake_test
resources by countryIs your feature request related to a problem? Please describe.
Setting up the provider requires to set the api_token in the provider block:
provider "statuscake" {
api_token = "my-api-token"
}
Describe the solution you'd like
I'd like the provider to look at some env var by itself, and only fallback to api_token
if this env var is not set.
Describe alternatives you've considered
To not harcode the api token, I have to explicitely define a TF_VAR_
terraform variable that I use in the provider
vs
so is it archived or not?
What's the relation to https://github.com/thde/terraform-provider-statuscake which seems to have far more features now?
Could an example be included for how to import existing statuscake configuration?
An example using terraform import
or other suitable method.
This is a documentation feature request for https://www.terraform.io/docs/providers/statuscake/index.html
I had to dig through the code to find test_id
as an available output.
What should have happened?
The outputs
should be available in documentation.
terraform --version
Terraform v0.12.16
After adding the following code (to test the provider)
resource "statuscake_test" "google" {
website_name = "google.com"
website_url = "www.google.com"
test_type = "HTTP"
check_rate = 300
contact_id = 12345
}
And after removing it from our hcl files, when applying:
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
- destroy
Terraform will perform the following actions:
# statuscake_test.google will be destroyed
- resource "statuscake_test" "google" {
- check_rate = 0 -> null
- confirmations = 0 -> null
- contact_id = 12345 -> null
- do_not_find = false -> null
- enable_ssl_alert = false -> null
- follow_redirect = false -> null
- id = "5348916" -> null
- node_locations = [] -> null
- paused = false -> null
- port = 0 -> null
- test_id = "5348916" -> null
- timeout = 0 -> null
- trigger_rate = 0 -> null
- uptime = 0 -> null
- use_jar = 0 -> null
}
Plan: 0 to add, 0 to change, 1 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
statuscake_test.google: Destroying... [id=5348916]
Error:
We've got an error without any explanations.
(abstract with TF_LOG="debug"
)
2020/01/03 15:41:33 [DEBUG] statuscake_test.google: apply errored, but we're indicating that via the Error pointer rather than returning it:
2020/01/03 15:41:33 [ERROR] <root>: eval: *terraform.EvalApplyPost, err:
2020/01/03 15:41:33 [ERROR] <root>: eval: *terraform.EvalSequence, err:
2020/01/03 15:41:33 [ERROR] <root>: eval: *terraform.EvalOpFilter, err:
2020/01/03 15:41:33 [TRACE] [walkApply] Exiting eval tree: statuscake_test.google (destroy)
2020/01/03 15:41:33 [TRACE] vertex "statuscake_test.google (destroy)": visit complete
None
statuscake_test.google should have been destroyed and removed from the state.
That was the case after several apply, but the resource remained in terraform state.
Manually removing is a workaround:
terragrunt state rm statuscake_test.google
Error without any explanation
See above.
I had to create an account in Statuscake, then this account is "invited" into a business subscription (in Statuscake). When I try to deploy resources in the workspace/sub-account I got invited to, the resources are created on the original account and not on the workspace/sub-account one.
Seems there should be a workspace/sub-account option that we can leverage to specify a workspace/sub-account vs the default account.
When I try to create or update a Test
, after the apply passed I can see the contact group on the Test
overview:
But when I go to the Edit Test
section, there is no contact group at all:
So no mail or notifications are send, when a test fail.
The StatusCake API return me a None
value on the variable contact_group
.
Also when I import an existing Test
with contact groups attached (create by hand) in the tfstate
the "contact_group"
is equal to "null"
I try with Terraform v10, v11 and v12
.
This issue was originally opened by @LukeDanielSmith as hashicorp/terraform#19572. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform v0.11.10
Module:
provider "statuscake" {
username = "devops"
alias = "scake"
version = "= 0.2.0"
}
resource "statuscake_test" "statuscake" {
provider = "statuscake.scake"
count = "${lookup("${var.statuscake_service_name}", "${var.layer_version}", "0") == 1 ? 1: 0}"
website_name = "${var.website_name == "" ? "TF-${var.environment}-${var.service}" : "${var.website_name}"}"
test_type = "${var.test_type}"
check_rate = "${var.check_rate}"
contact_id = "${var.contact_id["${var.environment}"] }"
website_url = "${var.website_url == "" ? "${var.zuul}/${var.service}/${var.health_endpoint}" : "${var.website_url}"}"
follow_redirect = "${var.follow_redirect}"
confirmations = "${var.confirmations}"
trigger_rate = "${var.trigger_rate}"
timeout = "${var.test_timeout}"
find_string = "${var.find_string}"
do_not_find = "${var.do_not_find}"
post_raw = "${var.post_raw}"
custom_header = "${var.custom_header}"
status_codes = "${var.status_codes}"
test_tags = "${var.test_tags}"
}
Resource:
module "statuscake_test_data_article_file" {
source = "../../../modules/statuscake_tests"
service = "${lookup(var.docker, "name")}"
environment = "${lookup(var.docker, "env")}"
layer_version = "${var.layer_version}"
test_tags = "${lookup(var.docker, "name")},${lookup(var.docker, "env" )},api"
website_name = "TF-${lookup(var.statuscake, "name")}"
website_url = "${lookup(var.statuscake, "statuscake_url")}"
check_rate = "${lookup(var.statuscake, "statuscake_check_rate")}"
confirmations = "${lookup(var.statuscake, "statuscake_confirmations")}"
custom_header = "${lookup(var.statuscake, "statuscake_custom_header")}"
}
tfvars:
statuscake = {
statuscake_custom_header = "{\"x-api-key\": \"<api-key>\"}"
name = "dev-statuscake_test-data-article-file"
statuscake_url = "https://api/endpoint"
statuscake_check_rate = "2"
statuscake_confirmations= "2"
}
2018/12/07 10:43:50 [DEBUG] apply: statuscake_test.statuscake: executing Apply
2018/12/07 10:43:50 [TRACE] root.statuscake_test_data_article_file: eval: *terraform.EvalApply
2018/12/07 10:43:50 [DEBUG] apply: statuscake_test.statuscake: executing Apply
2018/12/07 10:43:50 [TRACE] root.statuscake_test_data_novoda_file: eval: *terraform.EvalReadDiff
2018/12/07 10:43:50 [TRACE] root.statuscake_test_data_novoda_file: eval: *terraform.EvalCompareDiff
2018/12/07 10:43:50 [TRACE] root.statuscake_test_data_novoda_file: eval: *terraform.EvalGetProvider
2018/12/07 10:43:50 [TRACE] root.statuscake_test_data_novoda_file: eval: *terraform.EvalReadState
2018/12/07 10:43:50 [TRACE] root.statuscake_test_data_novoda_file: eval: *terraform.EvalApplyPre
2018/12/07 10:43:50 [TRACE] root.statuscake_test_data_novoda_file: eval: *terraform.EvalApply
2018/12/07 10:43:50 [DEBUG] apply: statuscake_test.statuscake: executing Apply
2018-12-07T10:43:50.884Z [DEBUG] plugin.terraform-provider-statuscake_v0.2.0_x4: 2018/12/07 10:43:50 [DEBUG] StatusCake Test Update for 3677792
2018-12-07T10:43:50.885Z [DEBUG] plugin.terraform-provider-statuscake_v0.2.0_x4: 2018/12/07 10:43:50 [DEBUG] StatusCake Test Update for 3677793
2018-12-07T10:43:50.886Z [DEBUG] plugin.terraform-provider-statuscake_v0.2.0_x4: 2018/12/07 10:43:50 [DEBUG] StatusCake Test Update for 3677791
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_grouped_index_file: eval: *terraform.EvalWriteState
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_grouped_index_file: eval: *terraform.EvalApplyProvisioners
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_grouped_index_file: eval: *terraform.EvalIf
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_grouped_index_file: eval: *terraform.EvalWriteState
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_article_file: eval: *terraform.EvalWriteState
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_grouped_index_file: eval: *terraform.EvalWriteDiff
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_grouped_index_file: eval: *terraform.EvalApplyPost
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_article_file: eval: *terraform.EvalApplyProvisioners
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_article_file: eval: *terraform.EvalIf
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_article_file: eval: *terraform.EvalWriteState
2018/12/07 10:43:51 [ERROR] root.statuscake_test_data_grouped_index_file: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:
* statuscake_test.statuscake: Error Updating StatusCake Test:
2018/12/07 10:43:51 [ERROR] root.statuscake_test_data_grouped_index_file: eval: *terraform.EvalSequence, err: 1 error(s) occurred:
* statuscake_test.statuscake: Error Updating StatusCake Test:
2018/12/07 10:43:51 [TRACE] [walkApply] Exiting eval tree: module.statuscake_test_data_grouped_index_file.statuscake_test.statuscake
2018/12/07 10:43:51 [TRACE] dag/walk: upstream errored, not walking "module.statuscake_test_data_grouped_index_file.provider.statuscake.scake (close)"
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_article_file: eval: *terraform.EvalWriteDiff
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_article_file: eval: *terraform.EvalApplyPost
2018/12/07 10:43:51 [ERROR] root.statuscake_test_data_article_file: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:
* statuscake_test.statuscake: Error Updating StatusCake Test:
2018/12/07 10:43:51 [ERROR] root.statuscake_test_data_article_file: eval: *terraform.EvalSequence, err: 1 error(s) occurred:
* statuscake_test.statuscake: Error Updating StatusCake Test:
2018/12/07 10:43:51 [TRACE] [walkApply] Exiting eval tree: module.statuscake_test_data_article_file.statuscake_test.statuscake
2018/12/07 10:43:51 [TRACE] dag/walk: upstream errored, not walking "module.statuscake_test_data_article_file.provider.statuscake.scake (close)"
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_novoda_file: eval: *terraform.EvalWriteState
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_novoda_file: eval: *terraform.EvalApplyProvisioners
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_novoda_file: eval: *terraform.EvalIf
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_novoda_file: eval: *terraform.EvalWriteState
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_novoda_file: eval: *terraform.EvalWriteDiff
2018/12/07 10:43:51 [TRACE] root.statuscake_test_data_novoda_file: eval: *terraform.EvalApplyPost
2018/12/07 10:43:51 [ERROR] root.statuscake_test_data_novoda_file: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:
* statuscake_test.statuscake: Error Updating StatusCake Test:
2018/12/07 10:43:51 [ERROR] root.statuscake_test_data_novoda_file: eval: *terraform.EvalSequence, err: 1 error(s) occurred:
* statuscake_test.statuscake: Error Updating StatusCake Test:
2018/12/07 10:43:51 [TRACE] [walkApply] Exiting eval tree: module.statuscake_test_data_novoda_file.statuscake_test.statuscake
2018/12/07 10:43:51 [TRACE] dag/walk: upstream errored, not walking "module.statuscake_test_data_novoda_file.provider.statuscake.scake (close)"
Statuscake resource should be provisioned
Errors out with the following message:
Error: Error applying plan:
3 error(s) occurred:
* module.statuscake_test_data_grouped_index_file.statuscake_test.statuscake: 1 error(s) occurred:
* statuscake_test.statuscake: Error Updating StatusCake Test:
* module.statuscake_test_data_article_file.statuscake_test.statuscake: 1 error(s) occurred:
* statuscake_test.statuscake: Error Updating StatusCake Test:
* module.statuscake_test_data_novoda_file.statuscake_test.statuscake: 1 error(s) occurred:
* statuscake_test.statuscake: Error Updating StatusCake Test:
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
terraform init
terraform apply
We use the statuscake provider across our infrastructure. However the service in question differs from the rest as it is the only one that uses a API endpoint that requires an API-key in its header as its healthcheck target. We also use a wrapper script when using Terraform.
Describe the bug
While trying options to workaround the rate limit issues experienced as per #91, it looks like the retries and backoff do not work
To Reproduce
Test configuration
provider "statuscake" {
retries = 10
min_backoff = 5
max_backoff = 60
rps = 7
}
Run terraform plan.
No retry is performed.
Expected behavior
The required number of retries with the expected backoff is performed
Additional context
version v2.0.4
Describe the bug
Hello StatusCakeDev team,
First, I'd like to thank you for this terraform provider, it's really helpful to use your product.
Here's an annoying bug I faced when trying to switch to your terraform provider and your new v1 API.
When creating a ssl check with the option on_broken
set to true
, it's not taken into account.
When trying to apply a second time , the terraform operations fails.
To Reproduce
XXXXXX is the exact same redacted value everywhere.
% terraform apply
[...]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# statuscake_ssl_check.bug will be created
+ resource "statuscake_ssl_check" "bug" {
+ check_interval = 86400
+ follow_redirects = false
+ id = (known after apply)
+ paused = false
+ alert_config {
+ alert_at = [
+ 1,
+ 7,
+ 30,
]
+ on_broken = true
+ on_expiry = true
+ on_mixed = false
+ on_reminder = true
}
+ monitored_resource {
+ address = "https://www.google.com"
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
statuscake_ssl_check.bug: Creating...
statuscake_ssl_check.bug: Creation complete after 1s [id=XXXXXX]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
% curl -s -H "Authorization: Bearer ${SC_API_KEY}" 'https://api.statuscake.com/v1/ssl/XXXXXX' | jq '.'
{
"data": {
"id": "XXXXXX",
"paused": false,
"check_rate": 86400,
"website_url": "https://www.google.com",
"issuer_common_name": "",
"cipher": "",
"cipher_score": 0,
"certificate_score": 0,
"certificate_status": "",
"contact_groups": [],
"alert_at": [
1,
7,
30
],
"last_reminder": 0,
"alert_reminder": true,
"alert_expiry": true,
"alert_broken": false, <== the problem is here
"alert_mixed": false,
"follow_redirects": false,
"mixed_content": [],
"flags": {
"is_extended": false,
"has_pfs": true,
"is_broken": false,
"is_expired": false,
"is_missing": false,
"is_revoked": false,
"has_mixed": false,
"follow_redirects": false
}
}
}
% terraform apply
[...]
statuscake_ssl_check.bug: Refreshing state... [id=XXXXXX]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# statuscake_ssl_check.bug will be updated in-place
~ resource "statuscake_ssl_check" "bug" {
id = "XXXXXX"
# (4 unchanged attributes hidden)
~ alert_config {
~ on_broken = false -> true
# (4 unchanged attributes hidden)
}
# (1 unchanged block hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
statuscake_ssl_check.bug: Modifying... [id=XXXXXX]
╷
│ Error: failed to update SSL check: Unexpected error. Try again later.
│
│ with statuscake_ssl_check.bug,
│ on main.tf line 39, in resource "statuscake_ssl_check" "bug":
│ 39: resource "statuscake_ssl_check" "bug" {
│
╵
Expected behavior
alert_broken
should be set to true
Additional informations
terraform {
required_providers {
statuscake = {
source = "StatusCakeDev/statuscake"
version = "2.0.3"
}
}
required_version = "~>1.2.5"
}
% terraform version
Terraform v1.2.5
on darwin_amd64
+ provider registry.terraform.io/statuscakedev/statuscake v2.0.3
Hi
Can you please create a release with terraform 0.12.x support?
It blocks us from upgrading to a latest terraform version
$ terraform -v
Terraform v0.11.13
+ provider.statuscake v0.2.0
Please list the resources as a list, for example:
Here are the sample configuration files:
main.tf
provider "statuscake" {
username = "${var.API_USER}"
apikey = "${var.API_KEY}"
}
resource "statuscake_test" "api_check" {
count = "${length(var.deployments)}"
contact_id = "${lookup(var.deployments[count.index], "live") == "1" ? var.contacts["operations"] : "0"}"
basic_user = "[email protected]"
basic_pass = "123456"
website_name = "Example ${lookup(var.deployments[count.index], "num")} (via API)"
website_url = "http://subdomain-${lookup(var.deployments[count.index], "num")}.example.com/api/something"
test_type = "HTTP"
check_rate = "${var.check_rate}"
trigger_rate = "${var.trigger_rate}"
confirmations = "${var.confirmations}"
follow_redirect = "true"
status_codes = "${var.status_codes}"
test_tags = "Terraform"
}
variables.tf
variable "API_USER" {
default = "{{ MY USER NAME }}"
}
variable "API_KEY" {
default = "{{ MY API KEY }}"
}
variable "website_name" {
default = ""
}
variable "website_url" {
default = ""
}
variable "contact_id" {
default = ""
}
variable "check_rate" {
default = "60"
description = "Number of seconds between tests"
}
variable "trigger_rate" {
default = "0"
description = "Number of minutes from first down to alert"
}
variable "confirmations" {
default = "3"
description = "Number of consecutive failures before declaring down"
}
variable "status_codes" {
default = "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, 408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 521, 522, 523, 524, 520, 598, 599"
description = "default list of status codes"
}
variable "contacts" {
type = "map"
default = {
operations = "109652"
}
}
variable "deployments" {
description = "List of deployments"
type = "list"
default = [
{name = "Deployment 1", num = "1", live = "1", test_uri="example.com"},
]
}
https://gist.github.com/Strainy/67de491a84f09533eda3175211107b2e
A check should have been created.
400 Error.
Please list the steps required to reproduce the issue, for example:
terraform apply
N/A
N/A
Describe the bug
When migrating from terraform v1 provider, we discovered that the v2 provider introduced a bug that makes it impossible to send headers because they are not formatted correctly.
"custom_header": "{\"Content-Type\":\"text/html; charset=utf-8\"}",
vs
"custom_header": "{ Content-Type = \"text/html; charset=utf-8\" }",
To Reproduce
Steps to reproduce the behavior:
The code used to request a string:
resource "statuscake_test" "my_test" {
custom_header = `{ Content-Type = \"text/html; charset=utf-8\"}`
}
And then it switched to request a map(string)
resource "statuscake_uptime_check" "my_test" {
...
http_check {
request_headers = {
"Content-Type": "text/html; charset=utf-8"
}
}
...
}
Additional context
Add any other context about the problem here.
For me, it seems related to the fact that the map(string)
is sent directly to the API without serializing it to JSON:
I wanted to confirm if the current version of this terrafor provider is compatible with the API V2.
I mean, it uses https://github.com/StatusCakeDev/statuscake-go under the hood, I didn't find any reference or branch mentioning its compatibility or plans for migrating to the API V2. Could you confirm it?
In the 1.x version of the provider, the status_codes
parameter to the statuscake_test
resources was optional and had sane defaults.
In the 2.x version of the provider, the equivalent parameter is required, which means that we need to supply a (long) list of HTTP response codes we want to trigger a failure for every single check we set up.
In our experience with the 1.x provider, the defaults were fine in the vast majority of cases, meaning the behaviour of the 2.x provider is needlessly verbose.
Terraform v0.11.10
+ provider.statuscake v0.2.0
It would be great if this provider supported creating/updating/deleting contact groups as well. It's supported in the StatusCake APi
Is your feature request related to a problem? Please describe.
It would be helpful if there was a Terraform resources for Push Tests.
Describe the solution you'd like
A new push monitor/test resource.
Describe alternatives you've considered
Or perhaps expending the currently uptime check resources to support push tests?
Additional context
NA
Release 2.0.0 is not available in the registry.
Please can it be
Is your feature request related to a problem? Please describe.
I wanted to use existing Slack and PagerDuty Integrations in new Contact Groups created using the terraform provider. The docs say, I have to add them by their ID but I cannot get their ID (or I don't know how to get their ID). I at least can't find out the Integration ID from the UI or API.
Describe the solution you'd like
Instead it would be nice to use the Integration name or any other (API-) retrievable information that's unique.
As an alternative to status_codes
parameter we can implement the accepted_status_codes
to add only few status code we want to not be triggered on.
For example, that's how it works now if I'd want to have 204 status code being accepted:
status_codes = "205, 206, 303, 400, 401, 403, 404, 405, 406, 408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 521, 522, 523, 524, 520, 598, 599"
How could it look like with the parameter accepted_status_codes
:
accepted_status_codes = "200, 204"
The parameter status_codes
should be ingnored if being set together with accepted_status_codes
one.
v0.12.5
provider "statuscake" {
username = "###"
apikey = "###"
}
resource "statuscake_test" "google" {
website_name = "google.com"
website_url = "www.google.com"
test_type = "HTTP"
check_rate = 300
trigger_rate = 5
confirmations = 1
}
The Status Codes field should be populated with the default.
According to the provider documentation for status_codes
https://www.terraform.io/docs/providers/statuscake/r/test.html
Defaults are "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, 408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 521, 522, 523, 524, 520, 598, 599".
This is true when creating a test manually but not threw terraform.
The Status Codes field is blank.
terraform apply
When I call the API using cURL the default values are populated so the provider is setting it to be blank instead of allowing the default behavior.
curl -H "API: ###" -H "Username: ###" -d "WebsiteName=MySite&WebsiteURL=www.google.com&CheckRate=300&TestType=HTTP" -X PUT https://app.statuscake.com/API/Tests/Update
Issue #5 addresses this but I still don't see the defaults being applied.
This may be because the provider is passing an empty string to the client: https://github.com/terraform-providers/terraform-provider-statuscake/blob/ebf8436f01bcacb71e3c378f08b165dfd6dd90e6/statuscake/resource_statuscaketest.go#L265
The Go status cake client may also need to be updated to add the option: querystringoptions:"omitempty"
https://github.com/DreamItGetIT/statuscake/blob/71a9c9823950c85cdacc28e362800a80119356e2/tests.go#L102
It would be great if we could also configure contact groups with this provider.
Terraform v1.1.7
on linux_amd64
provider registry.terraform.io/statuscakedev/statuscake v2.0.1-pre
variable "statuscake_tests" {
type = list(object({
website_name = string
website_url = string
test_type = string
check_rate = number
timeout = number
confirmations = number
trigger_rate = number
find_string = string
enable_ssl_alert = bool
follow_redirect = bool
do_not_find = bool
custom_header = map(string)
}))
default = [
{
website_name = "Test"
website_url = "https://google.com"
test_type = "HTTP"
check_rate = 60
timeout = 10
confirmations = 2
trigger_rate = 0
find_string = null
enable_ssl_alert = true
follow_redirect = true
do_not_find = false
custom_header = null
}
]
}
resource "statuscake_uptime_check" "test" {
for_each = {
for service in var.statuscake_tests :
service.website_name => service
}
name = each.value.website_name
check_interval = each.value.check_rate
confirmation = each.value.confirmations
trigger_rate = each.value.trigger_rate
monitored_resource {
address = each.value.website_url
}
http_check {
follow_redirects = each.value.follow_redirect
timeout = each.value.timeout
validate_ssl = each.value.enable_ssl_alert
request_headers = each.value.custom_header
dynamic "content_matchers" {
for_each = toset(each.value.find_string != null ? ["1"] : [])
content {
content = each.value.find_string
}
}
}
}
Resource statuscake_uptime_check.test["Test"] should be created with "trigger_rate = 0"
# terraform apply
Terraform will perform the following actions:
# statuscake_uptime_check.test["Test"] will be created
+ resource "statuscake_uptime_check" "test" {
+ check_interval = 60
+ confirmation = 2
+ id = (known after apply)
+ locations = (known after apply)
+ name = "Test"
+ paused = false
+ trigger_rate = 0
+ http_check {
+ enable_cookies = false
+ follow_redirects = true
+ request_method = "HTTP"
+ timeout = 10
+ validate_ssl = true
}
+ monitored_resource {
+ address = "https://google.com"
}
}
statuscake_uptime_check.test["Test"]: Creating...
statuscake_uptime_check.test["Test"]: Creation complete after 2s [id=1234]
# terraform show
statuscake_uptime_check.test["Test"]:
resource "statuscake_uptime_check" "test" {
check_interval = 60
confirmation = 2
id = "1234"
locations = []
name = "Test"
paused = false
trigger_rate = 4
http_check {
enable_cookies = false
follow_redirects = true
request_method = "HTTP"
status_codes = ["204","205","206","303","400","401","403","404","405","406","408","410","413","429","444","494","495","496","499","500","501","502","503","504","505","506","507","508","509","510","511","520","521","522","523","524","598","599",
]
timeout = 10
validate_ssl = true
}
monitored_resource {
address = "https://google.com"
}
}
As you can see, trigger_rate sets 4, as default number:
"trigger_rate": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Default: 4,
Description: "The number of minutes to wait before sending an alert",
},
If i try terraform apply once more:
Terraform will perform the following actions:
# statuscake_uptime_check.test["Test"] will be updated in-place
~ resource "statuscake_uptime_check" "test" {
id = "1234"
name = "Test"
tags = []
~ trigger_rate = 4 -> 0
# (5 unchanged attributes hidden)
~ http_check {
~ status_codes = [
- "204",
- "205",
- "206",
- "303",
- "400",
- "401",
- "403",
- "404",
- "405",
- "406",
- "408",
- "410",
- "413",
- "429",
- "444",
- "494",
- "495",
- "496",
- "499",
- "500",
- "501",
- "502",
- "503",
- "504",
- "505",
- "506",
- "507",
- "508",
- "509",
- "510",
- "511",
- "520",
- "521",
- "522",
- "523",
- "524",
- "598",
- "599",
]
# (7 unchanged attributes hidden)
}
# (1 unchanged block hidden)
}
It's expected behavior as result:
#terraform show
statuscake_uptime_check.test["Test"]:
resource "statuscake_uptime_check" "test" {
check_interval = 60
confirmation = 2
contact_groups = []
id = "1234"
locations = []
name = "Test"
paused = false
tags = []
trigger_rate = 0
http_check {
enable_cookies = false
follow_redirects = true
request_headers = {}
request_method = "HTTP"
request_payload = {}
status_codes = []
timeout = 10
validate_ssl = true
}
monitored_resource {
address = "https://google.com"
}
}
Status_codes have a similar problem for this example.
Terraform v0.11.13
+ provider.statuscake v0.2.0
Please list the resources as a list, for example:
resource "statuscake_test" "example_test" {
website_name = "example.com"
website_url = "example.com"
test_type = "HTTP"
contact_id = 146126
}
https://gist.github.com/tdmalone/85778595e2b6159b669214448f459562
* statuscake_test.example_test: Error creating StatusCake Test: json: cannot unmarshal string into Go struct field updateResponse.InsertID of type int
terraform apply
and type 'yes' when promptedterraform apply
again to observe Terraform wanting to create the test againI'm not sure what caused this behaviour - I have been creating tests semi-regularly for some time, and first encountered this issue today. I probably last successfully did this 1-2 weeks ago so it's possible something has changed (in the StatusCake API?) in that time.
Ay,
Terraform v0.12.28
See https://gist.github.com/KrustyHack/4c6a7793b03b8c65bdf269e5bcf0d131
All elements are here : https://gist.github.com/KrustyHack/4c6a7793b03b8c65bdf269e5bcf0d131
See terraform apply #1
and terraform apply #2
for Terraform apply output.
merged.tfvars #1
are variables used for terraform apply #1
and merged.tfvars #2
are variables used for terraform apply #2
(we deleted one check in it)
If I delete an http check all the checks order must not be broken. Here it seems that StatusCake is going mad and can't handle properly a check deletion.
If I delete one of my check in my checks array (see merged.tfvars
in gist) all the order is disrupted and it's not good because we can lost healthchecks history if we apply the plan.
terraform apply
with merged.tfvars #1
terraform apply
with merged.tfvars #2
: we deleted one check from the arrayThis issue was originally opened by @parabolic as hashicorp/terraform#10289. It was migrated here as part of the provider split. The original body of the issue is below.
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 v0.7.11
Please list the resources as a list, for example:
resource "statuscake_test" "ping" {
website_name = "${var.website_name}"
website_url = "${var.website_url}"
test_type = "${var.test_type}"
check_rate = "${var.check_rate}"
}
None
If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log
.
Status cake test should have been created with Alert Trigger Rate
and Confirmation Servers To Use
with a non zero value
Alert Trigger Rate
and Confirmation Servers To Use
are both set to zero
terraform apply
None
None
0.10.7
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
variable "status_cake_username" {}
variable "status_cake_api_key" {}
provider "statuscake" {
username = "${var.status_cake_username}"
apikey = "${var.status_cake_api_key}"
}
resource "statuscake_test" "my_test" {
website_name = "My test"
website_url = "https://www.google.com"
check_rate = 300
test_type = "HTTP"
paused = false
confirmations = 2
}
https://gist.github.com/strebor1982/714b15b086c135ad712258acc6225229
N/A
The default behaviour when creating a status cake test is to create a test with the default Alert Status Codes. This is confirmed by running a basic request on the status cake api
curl -X PUT \
https://app.statuscake.com/API/Tests/Update \
-H 'api: {apikey}' \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \
-H 'postman-token: 4a8656cc-61a2-af32-a79c-614293ee38fd' \
-H 'username: {username}' \
-d 'WebsiteName=MySite&WebsiteURL=http%3A%2F%2Fwww.google.com&CheckRate=300'
This will create a test with the default status codes - https://gist.github.com/strebor1982/8db9f314f32ea355075ab815e267845f
Tests are now being created without any Alert status codes
I have noticed that there was a commit on the status cake client library used by the status cake provider which I think has broken this - DreamItGetIT/statuscake@63610f9
As the statuscake_test has no way of actually setting the status codes via a variable there is no way to correct this behaviour
terraform apply
N/A
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
Terraform v0.11.14 and v0.12.21
resource "statuscake_test" "test" {
...
user_agent = "test123"
}
https://gist.github.com/tjend/b200a20038091df631c1e7c76070cc99
User agent should be updated within statuscake.
An error occurs("No data has been updated (is any data different?)"), statuscake is not updated, but the tfstate file is updated as if it worked.
terraform apply
When not using a custom user agent, no error occurs. The api documentation for statuscake, https://www.statuscake.com/api/Tests/Updating%20Inserting%20and%20Deleting%20Tests.md, currently doesn't mention the user agent. However testing with curl works as expected, "curl -H "API: [key]" -H "Username: [user]" -d "TestID=5421105&UserAgent=test123" -X PUT https://app.statuscake.com/API/Tests/Update".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.