[x] Ensure you have latest version of plugin installed
[x] Search for possible issue duplicates
Installation details
[X] IDE version (Help->About->Copy to Clipboard)
PyCharm 2020.2.3 (Community Edition)
Build #PC-202.7660.27, built on November 15, 2020
Runtime version: 11.0.8+10 amd64
VM: OpenJDK 64-Bit Server VM by N/A
Linux 5.9.10-arch1-1
GC: ParNew, ConcurrentMarkSweep
Memory: 959M
Cores: 4
Non-Bundled Plugins: org.intellij.plugins.hcl, com.intellij.plugins.watcher
Current Desktop: XFCE
[X] intellij-hcl plugin version (Settings->Plugins)
0.7.10
[x] Terraform version (terraform -v)
Terraform v0.13.5
Terraform Configuration Files
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.38.0"
}
}
}
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
location = "East US"
name = "test"
}
resource "azurerm_network_security_group" "nsg" {
name = "test_nsg"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
}
resource "azurerm_network_security_rule" "rule" {
access = "Deny"
direction = "Inbound"
name = "TestRule"
network_security_group_name = azurerm_network_security_group.nsg.name
priority = 1000
protocol = "tcp"
resource_group_name = azurerm_resource_group.test.name
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
# Here's where things go wrong - these will both be highlighted as being errors,
# even if one of them is marked null and therefore doesn't really 'exist'.
destination_address_prefix = "10.0.0.100"
destination_address_prefixes = null
}
Exception
None.
Expected Behavior
terraform plan and terraform apply work successfully.
No errors or warnings shown by plugin in IDE.
Actual Behavior
Two problems are listed in 'Problems' view:
Conflicts with: destination_address_prefixes
Conflicts with: destination_address_prefix
Steps to Reproduce
Place above sample code in an editor window.
Observe red underlines. :smiley:
Hello!
I noticed a seemingly incorrect behaviour with the HCL plugin today. In cases where two attributes of a resource are mutually exclusive, the plugin will show those attributes as being in error even if one is marked null. In my example above, it's worth noting that terraform plan and terraform apply are fine with this configuration but the plugin thinks it's a problem.
In the example above, the azurerm_network_security_rule resource has several attribute pairs that are mutually exclusive and the same behaviour is observed for all of them:
source_port_range and source_port_ranges
source_address_prefix and source_address_prefixes
destination_port_range and destination_port_ranges
destination_address_prefix and destination_address_prefixes
Also, my usage of azurerm_network_security_rule above is a trivial example and should never be used this way. :smile: My actual use case is to conditionally use one of the attributes and mark the other one as null when not being used depending on the condition being evaluated.
Prerequisites
Installation details
[X] IDE version (
Help->About->Copy to Clipboard
)[X] intellij-hcl plugin version (
Settings->Plugins
)[x] Terraform version (
terraform -v
)Terraform Configuration Files
Exception
Expected Behavior
terraform plan
andterraform apply
work successfully.Actual Behavior
Two problems are listed in 'Problems' view:
Conflicts with: destination_address_prefixes
Conflicts with: destination_address_prefix
Steps to Reproduce
Hello!
I noticed a seemingly incorrect behaviour with the HCL plugin today. In cases where two attributes of a resource are mutually exclusive, the plugin will show those attributes as being in error even if one is marked
null
. In my example above, it's worth noting thatterraform plan
andterraform apply
are fine with this configuration but the plugin thinks it's a problem.In the example above, the
azurerm_network_security_rule
resource has several attribute pairs that are mutually exclusive and the same behaviour is observed for all of them:source_port_range
andsource_port_ranges
source_address_prefix
andsource_address_prefixes
destination_port_range
anddestination_port_ranges
destination_address_prefix
anddestination_address_prefixes
Also, my usage of
azurerm_network_security_rule
above is a trivial example and should never be used this way. :smile: My actual use case is to conditionally use one of the attributes and mark the other one asnull
when not being used depending on the condition being evaluated.Thanks for taking the time to read this!