You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is poor practice to include in a declaration of a resource (excluding the resource block contents), any name-part of the resource type, as this leads to longer than necessary names in state-files and longer processing time for engineers to infer resources. These code examples set the standards for new engineers and they should not be led away from best practices, especially in these early stages.
Below is an example where the ibm_resource_instance has a new declaration of pdns-instance, thus duplicating the word instance in the statefile. Its already clear that its an instance by the declaration of the resource type, it does not need to be mentioned again in the name.
Example:
resource "ibm_resource_instance" "pdns-instance" {
name = "pdns-instance"
resource_group_id = data.ibm_resource_group.rg-dns.id
location = "global"
service = "dns-svcs"
plan = "standard-dns"
}
An easy substitute would be to use an integer in resource identifiers like example-01, instead of example-instance.
Solution:
resource "ibm_resource_instance" "pdns-01" {
name = "pdns-instance-01"
resource_group_id = data.ibm_resource_group.rg-dns.id
location = "global"
service = "dns-svcs"
plan = "standard-dns"
}
The text was updated successfully, but these errors were encountered:
65156
changed the title
examples include names that go against naming convention best practices, and du
code examples include resource names that go against naming convention best practices.
Jan 8, 2024
It is poor practice to include in a declaration of a resource (excluding the resource block contents), any name-part of the resource type, as this leads to longer than necessary names in state-files and longer processing time for engineers to infer resources. These code examples set the standards for new engineers and they should not be led away from best practices, especially in these early stages.
Below is an example where the ibm_resource_instance has a new declaration of pdns-instance, thus duplicating the word instance in the statefile. Its already clear that its an instance by the declaration of the resource type, it does not need to be mentioned again in the name.
Example:
An easy substitute would be to use an integer in resource identifiers like example-01, instead of example-instance.
Solution:
Direct Example: https://github.com/IBM-Cloud/terraform-provider-ibm/blob/b991118092aebc153f86b113b9a82f5bd4410520/examples/ibm-dns-linked-zone/main.tf#L1C44-L1C45
This is throughout all IBM provider documentation
The text was updated successfully, but these errors were encountered: