Comments (2)
Hello @ryanbratten, thank you for your suggestion. I value your input. I chose the JSON approach primarily due to the diverse nature of the configuration items. For instance, for the same property name, the value can vary between a string and an integer, depending on the type of configuration item. Take targetIdentifier
as an example. According to the documentation:
targetIdentifier: The ID of the target. This must be an integer for PagerDuty and Sentry apps, and a string for all others. Examples of appropriate values include a Slack channel name (#my-channel), a user ID, a team ID, a Sentry app ID, etc.
Due to Terraform's limitations, it's impractical to use the same property name for a union type (e.g., string and integer). Consequently, we would need to name these properties explicitly, such as pageduty_id
, sentry_app_id
, etc., with the appropriate types.
Alternatively, we could consider creating a data source for each condition, filter, and action that outputs JSON. A prime example is AWS's iam_policy_document, which generates a policy JSON that can be used with iam_policy.policy. We could adopt a similar approach and not introduce another incompatible change. Whenever a new configuration item is introduced, users can manually create the JSON and immediately use the new functionality while the data source that generates the JSON can be developed.
For the time being, I recommend using Terraform's jsonencode()
function to construct your JSON. In your case, you can utilize Terraform arrays with jsonencode()
to maintain HCL highlighting and facilitate the translation of Terraform language into JSON effectively. However, take extra care as HCL is unable to distinguish between an integer and a float.
actions = jsonencode([
for channel in var.slack_channels:
{
id = "sentry.integrations.slack.notify_action.SlackNotifyServiceAction"
channel = channel
workspace = data.sentry_organization_integration.slack.internal_id
}
])
I hope this helps!
from terraform-provider-sentry.
For the time being, I recommend using Terraform's
jsonencode()
function to construct your JSON.
Note that the docs say to avoid jsonencode()
due to the int/float problem: https://registry.terraform.io/providers/jianyuan/sentry/latest/docs/resources/issue_alert
Are you suggesting that parseint()
can make this safe? I'm also unclear on how that's even a problem because I can't imagine floats are being used as identifiers (and JSON itself also cannot distinguish between ints and floats)?
from terraform-provider-sentry.
Related Issues (20)
- Cannot set "bun" as platform HOT 1
- No information about platform settings
- Bug in sentry_notification_action resource that produced inconsistent result after apply
- Could not validate the platform at this time "go"
- Terraform provider does not support adding integration configuration to setup this label/api key table in opsgenie integration
- Error deleting project inbound data filter
- Always showing updates in-place for `sentry_project_inbound_data_filter` for `filter_id = "legacy-browsers"` HOT 1
- Add the Slack channel to the Sentry_team ressource
- Duplicate resources are created by default
- List of Acceptable Project Platform Values HOT 2
- Changed sentry_key DSNs HOT 1
- Supports for comparisonDelta in metric alerts
- Pagerduty service integration
- [Data residency] Support for EU data residency in organisation resource HOT 1
- UUID not included when running updating Alert in Terraform Apply HOT 1
- sentry_issue_alert condition issue HOT 5
- Sentry not assigning platform correctly.
- Sentry not using `slug` input HOT 5
- [Alert Rule Misconfiguration] Provider produced inconsistent result when applying changes to sentry_issue_alert HOT 3
- Error when handling externally-deleted organization member
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-sentry.