State File !FULL!
A state file is a file used by the IaC tool to record information about what has been deployed by the tool. Often these are JSON files and will contain a representation of every object that has been deployed by the tool, including all the configuration options specified when creating the resource and all the outputs returned by the cloud provider.
Generally, there will be a separate state file for each IaC project deployed, and often when you are deploying the same infrastructure multiple times with different parameters, there is also a state file for each deployment.
There are reasons why some IaC tools use a state file; otherwise, it would be a waste of time to manage this file. The state file allows the IaC tool to know the current state of resources it has deployed quickly, without needing to refer to the cloud provider and to keep track of what it has deployed. By doing this, the tool gets several key benefits.
Another benefit of tracking what you deploy is that you can destroy it. Stateful tools know exactly what resources were deployed as part of a project because they are noted in the state file. This means that the tool can offer a destroy option where it will clean up resources that it created for you with a single command. This can be a significant benefit, especially with dev/test environments where you want to create, run some work and then quickly destroy them.
Because the state file has a complete record of the resource that were created, including all the properties on the resource, it knows how to recreate this resource. This is useful if you need to change a property on a resource that does not support changing it. If you try this in an ARM or Bicep template, you will get an error stating that the resource does not support changing the property. In a stateful language, if this happens, it can delete and recreate the resource with the new setting to get it into the state you want. It can do this because it knows precisely what that resource needs to look like based on the state file.
Sometimes you may have multiple deployment projects that need to share information between them. You might need to get an output from a resource deployed in one project to use as input into the next project. Most stateful tools have the facilities for a project to read the state file of a previous deployment and grab values from this last project to use in the current one. This can just be reading resource properties, or it can be more complex things like retrieving keys or secrets from resources created in the first project that needs to be accessed in the second. This can be a significant benefit for resources where secrets are created once and not readable after the fact, as this data can then be accessed through the state file after the fact (this comes with some downsides, so see the later section).
For stateless tools to replicate this functionality, you either need the last project to access the cloud resources directly and read the properties (which means they need access) or store these values in an intermediate tool like Key Vault or App Configuration.
In a stateless tool, all of the infrastructure properties must be sent to the cloud provider and run against the cloud infrastructure, even if there is only a tiny change. This can lead to a significant increase in time if there are lots of resources.
The state file not only records what resources have been deployed but also what resources have dependencies on each other. This should prevent the deletion of resources where there are dependencies that have not been deleted. With a stateless tool, it is straightforward to manually delete resources that other things depend on.
Some tools, like Pulumi, have built-in encryption for state files which can make this a bit easier, but you still need to manage how that encryption will work and where the key comes from. Terraform, however, does not offer state encryption out of the box. Some plugins and community add-ons can help you achieve this, but more work needs to be done.
A significant benefit of a stateless tool like Bicep is that I can take a .bicep file, point it at a resource group and run it, and it will deploy. If I want to rerun it with different parameters to create a second environment, I just rerun it with a different value passed to the parameters. For a stateful language, I must create the state file before running anything. This means figuring out where the state file is going to go, getting access to that location, securing the file, setting up any encryption for secrets etc.
Importing existing resources into a stateful project is painful in every tool that supports it. There have been multiple attempts to make this easier, but at the end of the day, you are trying to integrate a one-off imperative task that needs a lot of upfront information into a declarative process designed to be run over and over. If you have existing resources that you need to bring into a project, then there will be a lot of upfront manual work that needs to be done to manage that import process.
If you spend time working with stateful languages, you will experience issues with the state file having problems or getting corrupted. The most common cause of this is a situation where a deployment failed part way through, and the IaC tool thinks it is in an inconsistent state. It will usually mark certain elements in the state file as having problems, and you will need to go in and tell it what condition they are in or revert some changes it has made. Often this can be fixed relatively quickly, but it still takes time.
On some occasions, however, you can find you have got into a state where what the state file thinks is real and what it is, is very different. The error indicating that a resource already exists, but is not in the state file, despite you knowing that the IaC tool is the one that created it, is very frustrating. In these scenarios, it can be easier to delete the whole deployment, clear out the state file, and start again. This is pretty easy to do in dev but not so in production. This may mean reverting to a backup of the state file, but now you need to deal with any resources or changes to resources that are not in the state file.
State files can be a very powerful tool and bring several benefits. However, they also bring complexity and opportunities for more things to go wrong. Consider carefully whether the benefits of the state file are useful to you, and if they are not, whether a stateless tool might make your life easier. Remember that one of the benefits of the state file is being able to use the tool it supports. Even if you do not need any of the benefits we have listed here, if you want the multi-cloud abilities of Terraform or Pulumi, then the state file is part of the package, and you may need to accept it as the cost of using those languages.
To establish an account, please click on the icon below. The fees associated with the SOSDirect account are the fees for documents filed, for copies and certificates ordered, and inquiries submitted. There are no monthly subscription fees.
For everything you'll need to choose the right software and prepare your return, see Get ready to e-file your income tax return. For additional tools, see Filing season resource center for additional filing information.
Names checked for availability must be distinguishable from corporate, limited liability company and trade names already on file, or reserved, in the Secretary of State's office. In addition to checking names by various spellings (Cajun vs. Kajun), names are checked phonetically (excellent vs. x e lent). (Partnership names do not conflict and are not considered when checking name availability for the above listed entities. Trademarks and service marks are only conflicted with other trademarks and service marks registered in the same class.) No corporate or limited liability company name shall contain the phrase "doing business as" or the abbreviation "d/b/a". The names of revoked Louisiana corporations and limited liability companies are not available for a three year period after the date of revocation.
The name shall not imply that the corporation is an administrative agency of any parish or of this state or of the United States. The following are words which are prohibited from use in Louisiana business corporate names, except for bank holding companies: bank, banker, banking, savings, safe deposit, trust, trustee, building and/or loan, homestead, insurance, casualty, redevelopment corporation, electric cooperative, and credit union. No corporation shall use the word insurance in its name except for an independent insurance agency or brokerage.
Written waivers from two state boards are required for use of certain words in corporate names. If "engineer", "engineering", "surveyor" or "surveying" will be part of the corporate name, a waiver must be obtained from the Louisiana Professional Engineering & Land Surveying Board, 9643 Brookline Ave., Suite 121, Baton Rouge, LA 70809-1443, 225.925.6291. In order to include "architect," "architectural" or "architecture," a waiver must be obtained from the Louisiana State Board of Architectural Examiners, 8017 Jefferson Highway, Suite B2, Baton Rouge, LA 70809, 225.925.4802. In order to include the form of the words "bank" or "trust," a waiver must be obtained from the Office of Financial Institutions, P.O. Box 94095, Baton Rouge, LA 70804, 225.925.4548.
The corporate name shall not imply that the corporation is an administrative agency of any parish or of this state or of the United States. It shall not contain any of the following words: bank, banking, banker, savings, trust, deposit, insurance, mutual, assurance, indemnity, casualty, fiduciary, homestead, building and loan, surety, security, guarantee, cooperative, state, parish, redevelopment corporation, electric cooperative or credit union.
The name shall not imply that the corporation is an administrative agency of any parish or of this state or of the United States. The LLC name shall not contain any word or phrase which indicates or implies that it is organized for any purpose not lawful for a limited liability company or contrary to its articles of organization. A limited liability company shall not be formed for the purpose of banking or insurance underwriting in all of their several forms or for the purpose of operating homesteads or building and loan associations. 041b061a72