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

Boring resource names generated by the converter #147

Closed
t0yv0 opened this issue Apr 18, 2024 · 6 comments
Closed

Boring resource names generated by the converter #147

t0yv0 opened this issue Apr 18, 2024 · 6 comments
Labels
kind/bug Some behavior is incorrect or out of spec resolution/by-design This issue won't be fixed because the functionality is working as designed

Comments

@t0yv0
Copy link
Member

t0yv0 commented Apr 18, 2024

What happened?

@thomas11 points out that rolling out the converter to providers generated diffs such as this one:

  - ///     var exampleGit = new AzureDevOps.Git("exampleGit", new()
  + ///     var exampleGit = new AzureDevOps.Git("example", new()

Notice that the name selected the resource is now "example" which is more boring than "exampleGit", and several resources are now all named "example". Granted, the original HCL also has lots of resources named "example", but we use to provide this little enhancement and now do not anymore.

There is no impact on validity, only aesthetics.

Example

resource "azuredevops_project" "example" {
  name = "Example Project"
}

resource "azuredevops_git_repository" "example" {
  project_id = azuredevops_project.example.id
  name       = "Example Repository"
  initialization {
    init_type = "Clean"
  }
}

resource "azuredevops_build_definition" "example" {
  project_id = azuredevops_project.example.id
  name       = "Example Build Definition"

  repository {
    repo_type = "TfsGit"
    repo_id   = azuredevops_git_repository.example.id
    yml_path  = "azure-pipelines.yml"
  }
}

resource "azuredevops_branch_policy_build_validation" "example" {
  project_id = azuredevops_project.example.id

  enabled  = true
  blocking = true

  settings {
    display_name        = "Example build validation policy"
    build_definition_id = azuredevops_build_definition.example.id
    valid_duration      = 720
    filename_patterns = [
      "/WebApp/*",
      "!/WebApp/Tests/*",
      "*.cs"
    ]

    scope {
      repository_id  = azuredevops_git_repository.example.id
      repository_ref = azuredevops_git_repository.example.default_branch
      match_type     = "Exact"
    }

    scope {
      repository_id  = azuredevops_git_repository.example.id
      repository_ref = "refs/heads/releases"
      match_type     = "Prefix"
    }
    
    scope {
      match_type     = "DefaultBranch"
    }
  }
}

Output of pulumi about

N/A

Additional context

N/A

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@t0yv0 t0yv0 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Apr 18, 2024
@Frassle
Copy link
Member

Frassle commented Apr 18, 2024

I'd argue this is by design. We make the resource logical name match the terraform name.

@t0yv0
Copy link
Member Author

t0yv0 commented Apr 18, 2024

Yeah. Feel free to close.

@justinvp justinvp added resolution/by-design This issue won't be fixed because the functionality is working as designed and removed needs-triage Needs attention from the triage team labels Apr 19, 2024
@justinvp justinvp closed this as not planned Won't fix, can't repro, duplicate, stale Apr 19, 2024
@thomas11
Copy link

I don't agree with @t0yv0 that this is only about aesthetics. It's objectively worse for a user if they copy it as-is. When they look at resources outside of Pulumi, or in Pulumi state, they're all named example-123, example-abc, etc. and are indistinguishable by name. Sure, expressive names are not required since there are unique urns, but they make various tasks easier and quicker.

@t0yv0
Copy link
Member Author

t0yv0 commented Apr 19, 2024

By aesthetics I just mean it doesn't affect pulumi up breaking. I see your POV but TF could fix their examples as well (where examples are coming from). I get a sense that if you want to put time in to contribute a fix here Justin's team may be amenable - I'm sorry for writing "feel free to close" I guess I just don't feel as strongly about this one, should have let you write the ticket.

@Frassle
Copy link
Member

Frassle commented Apr 19, 2024

It's objectively worse for a user if they copy it as-is.

But no worse than terraform docs for the same thing, and I'm not sure users doing TF state conversions would expect all their resources to be renamed to have the type name suffixed.

@t0yv0
Copy link
Member Author

t0yv0 commented Apr 19, 2024

Yeah this kind of feature if we did it would need to be opt-in for documentation use case only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/by-design This issue won't be fixed because the functionality is working as designed
Projects
None yet
Development

No branches or pull requests

4 participants