Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add naming conventions for infrastructure as code #533

Open
psirenny opened this issue Nov 9, 2024 · 0 comments
Open

Add naming conventions for infrastructure as code #533

psirenny opened this issue Nov 9, 2024 · 0 comments
Assignees

Comments

@psirenny
Copy link
Contributor

psirenny commented Nov 9, 2024

I've come across two schools of thoughts for naming resources:

  1. Include resource type followed by semantic name — Omit semantic name if one doesn’t exist
  2. Exclude resource type from resource name — Provide a semantic name instead; if one doesn’t exist then use this

e.g.:

const rdsCluster = new aws.rds.DbCluster("rds-cluster", {
  engine: "aurora-postgresql",
  engineVersion: "15.4",
  // …
});

new aws.rds.DbInstance("rds-instance-private", {
  dbClusterIdentifier: rdsCluster.id,
  publiclyAccessible: true,
  // …
});

new aws.rds.DbInstance("rds-instance-public", {
  dbClusterIdentifier: rdsCluster.id,
  publiclyAccessible: false,
  // …
});

vs.

const rdsCluster = new aws.rds.DbCluster("this", {
  engine: "aurora-postgresql",
  engineVersion: "15.4",
  // …
});

new aws.rds.DbInstance("private", {
  dbClusterIdentifier: rdsCluster.id,
  publiclyAccessible: true,
  // …
});

new aws.rds.DbInstance("public", {
  dbClusterIdentifier: rdsCluster.id,
  publiclyAccessible: false,
  // …
});

I'm accustomed to approach 1 but it comes with lots of problems. Namely:

  • It's verbose
  • It's redundant
  • It leads to inconsistency because no one agrees on service names (Including the resource Providers themselves 😆)

On the other hand, it probably is more common.

@psirenny psirenny self-assigned this Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant