terraform init
- this will read your tf file and decide what plugins you are using and install them. Creates a .terraform directory in your working directory.terraform plan
- shows what changes will be made without making themterraform fmt
- will format your file to look all prettyterraform validate
- will check your config file for errorsterraform apply
- shows the money!! This should apply all of the changes for you (after you indicate yes
)terraform.tfstate
file after applying. Has ALLL your AWS info, so terraform knows what it is managing.terraform show
will show all the information from the state file.terraform destroy
terminates resources described in your config file, the opposite of terraform apply.In the previous example, we had to attach the sg to the instance, but at creation time we don't actually know the id's for any of these. An expression allows us to select the approprate sg by accessing other parts of your code.
A resource attribute reference is a type of expression that we used in the example <Provider>_<type>.<name>.<attribute>
. In the example it was, aws_security_group.instance.id
Check your tf files into git... but not any credentials.