Is there any way to prevent a block from executing in a resource if a condition is not satisfied .
I am facing This object does not have an attribute named when it fails to find the element in the list of variables.
I am trying to create the newrelic_one_dashboard with dynamic blocks but at some cases the page will not have certain attributes and is throwing error .So I want to make it in such a way that this block should execute only if a condition is met or an argument is present in the variables
A code in terraform something like below code
if(locals.page.value. widget_area ! = null ){
widget_area{
// This is a block
Can you post a more detailed example of what you’re trying to achieve? Please use code blocks (clicking the <> button in the editor) to make it easier to read.
I think in this case the best option is to use dynamic blocks for your dashboard widgets. To do this, you’ll want to construct a list of objects representing each widget, then use for_each inside a dynamic block to iterate over them.