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

New Code Action: Expose an attribute/block as output #1533

Open
13 tasks
radeksimko opened this issue Dec 20, 2023 · 0 comments
Open
13 tasks

New Code Action: Expose an attribute/block as output #1533

radeksimko opened this issue Dec 20, 2023 · 0 comments
Labels

Comments

@radeksimko
Copy link
Member

Background

When refactoring existing configuration, one of the actions users may want to take is to expose an attribute as an output. This is especially relevant if the configuration represents a published module or the refactoring has intentions to turn it into one.

For example, the user may start with:

resource "azurerm_app_service_environment" "foo" {
  name                = "foo"
  resource_group_name = "toot"
  subnet_id           = "noot"
}

and want to end up with:

resource "azurerm_app_service_environment" "foo" {
  name                = "foo"
  resource_group_name = "toot"
  subnet_id           = "noot"
}

output "subnet_id" {
  value = azurerm_app_service_environment.foo.subnet_id
}

or maybe end up with:

resource "azurerm_app_service_environment" "foo" {
  name                = "foo"
  resource_group_name = "toot"
  subnet_id           = "noot"
}

output "azurerm_app_service_environment_foo" {
  value = azurerm_app_service_environment.foo
}

Proposal

  • Implement code action to "expose" any addressable attribute in following blocks
    • resource
    • data
    • module
    • output
    • provider
    • locals
  • Implement code action to "expose" any addressable blocks as whole
    • resource
    • data
    • module
    • output
    • provider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant