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 a data source for storage accounts #785

Closed
eefi opened this issue Feb 2, 2018 · 4 comments · Fixed by #794
Closed

Add a data source for storage accounts #785

eefi opened this issue Feb 2, 2018 · 4 comments · Fixed by #794

Comments

@eefi
Copy link
Contributor

eefi commented Feb 2, 2018

We have a use case that could really make use of a storage account data source. Is there a philosophical reason why that doesn't exist right now? (Or why the current set of data sources are the data sources that do exist?)

We have our infrastructure deployed through a collection of modules, and one of our patterns has been to define a shared resource in one module, and then use a data source in another module to do things to it. For example, a core module might define a virtual network resource, and then we'd make a data source for that virtual network in a different module that might want to add a subnet to it.

I understand the data source isn't strictly necessary, since you can generally just refer to things by name, which you need to get the data source in the first place anyway. But it's a little peace of mind (and easier debugging?) when the data source object fails first during a Terraform run if the referenced resource isn't there.

@tombuildsstuff tombuildsstuff added this to the 1.1.1 milestone Feb 3, 2018
@tombuildsstuff tombuildsstuff self-assigned this Feb 3, 2018
tombuildsstuff added a commit that referenced this issue Feb 5, 2018
Fixes #785

Tests pass:

```
$ acctests azurerm TestAccAzureRMPublicIpStatic_basic
=== RUN   TestAccAzureRMPublicIpStatic_basic
--- PASS: TestAccAzureRMPublicIpStatic_basic (83.19s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	83.219s
```
tombuildsstuff added a commit that referenced this issue Feb 5, 2018
Fixes #785

Tests pass:

```
$ acctests azurerm TestAccDataSourceAzureRMStorageAccount_
=== RUN   TestAccDataSourceAzureRMStorageAccount_basic
--- PASS: TestAccDataSourceAzureRMStorageAccount_basic (86.65s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	86.675s
```
@tombuildsstuff
Copy link
Contributor

hey @eefi

Thanks for opening this issue :)

We have a use case that could really make use of a storage account data source. Is there a philosophical reason why that doesn't exist right now? (Or why the current set of data sources are the data sources that do exist?)

Totally agree a Data Source for Storage Accounts could be really useful - as such I've opened PR #794 which adds support for this.

Historically Data Sources have been added as the demand for them arises, rather than adding them ahead of time. There's a longer term task to go through and backfill some of the existing Resources as Data Sources here (e.g. Storage Accounts) - but for new Resources we're adding a Data Source shortly after the Resource is supported if it makes sense (for instance, Network Security Groups probably will get a Data Source, but I don't believe we need one for Network Security Rules [since you're not likely to reference it elsewhere]).

Thanks!

@eefi
Copy link
Contributor Author

eefi commented Feb 6, 2018

Thank you for the explanation and the quick implementation! Looking forward to using the new data source soon!

@tombuildsstuff
Copy link
Contributor

@eefi just to let you know that this has been released in v1.1.1 :)

@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants