I am trying to create an NrqlAlertCondition. This requires a policy_id parameter.
Before creation of NrqlAlertCondition, I am creating an AlertPolicy. I should be able to typecast the id of the alertPolicy in to a number using Token.as_number and be able to pass this as the policy_id parameter of NrqlAlertCondition
Actual Behavior
policy_id of NrqlAlertCondition accepts an int or float. The policy.id that we get from AlertPolicy is a string like ${TfToken[TOKEN.244]}. When I typecast this to a number using Token.as_number and pass it as the policy_id parameter of NrqlAlertCondition, I get the following error:
⠙ Processing
[2024-06-13T15:56:13.186] [ERROR] default - ╷
│ Error: Attribute must be a whole number, got -1.8881545897087635e+289
│
│ with newrelic_nrql_alert_condition.oaac_test_dev_test-group_23730378,
│ on cdk.tf.json line 5908, in resource.newrelic_nrql_alert_condition.oaac_test_dev_test-group_23730378:
│ 5908: "policy_id": -1.8881545897087635e+289
│
dev ╷
│ Error: Attribute must be a whole number, got -1.8881545897087635e+289
│
│ with newrelic_nrql_alert_condition.oaac_test_dev_test-group_23730378 (oaac_test_dev_test-group_23730378),
│ on cdk.tf.json line 5908, in resource.newrelic_nrql_alert_condition.oaac_test_dev_test-group_23730378 (oaac_test_dev_test-group_23730378):
│ 5908: "policy_id": -1.8881545897087635e+289
│
╵
The policy_id, is the Id of the alert policy, that I create in the same terraform run. I am able to successfully create the alert policies on NewRelic as well. The problem is, when I try to pass it the the alert_condittion, I get this error.
Steps to Reproduce
Create a NewRelic alert policy.
Cast the id of policy created earlier, using Token.as_number and try passing it the policy_id parameter while creating a NrqlAlertCondition
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
Expected Behavior
I am trying to create an
NrqlAlertCondition
. This requires apolicy_id
parameter.Before creation of
NrqlAlertCondition
, I am creating anAlertPolicy
. I should be able to typecast theid
of thealertPolicy
in to a number usingToken.as_number
and be able to pass this as thepolicy_id
parameter ofNrqlAlertCondition
Actual Behavior
policy_id
ofNrqlAlertCondition
accepts an int or float. Thepolicy.id
that we get fromAlertPolicy
is a string like${TfToken[TOKEN.244]}
. When I typecast this to a number usingToken.as_number
and pass it as thepolicy_id
parameter ofNrqlAlertCondition
, I get the following error:The policy_id, is the Id of the alert policy, that I create in the same terraform run. I am able to successfully create the alert policies on NewRelic as well. The problem is, when I try to pass it the the alert_condittion, I get this error.
Steps to Reproduce
id
of policy created earlier, usingToken.as_number
and try passing it thepolicy_id
parameter while creating aNrqlAlertCondition
Versions
Providers
newrelic/newrelic │ 3.37.1 │ ^0.20.0 │ │ cdktf-cdktf-provider-newrelic │ 12.8.1
Gist
No response
Possible Solutions
No response
Workarounds
No response
Anything Else?
Related to https://github.com/hashicorp/terraform-cdk/issues/3642
References
No response
Help Wanted
Community Note