heyday / xterraform
xTerraform package will provide project with easily scalable and maintainable cloud infrastructure.
README
xTerraform package will provide project with easily scalable and maintainable cloud infrastructure.
Contents
Requirements
-
Install Terraform CLI in your machine: [https://www.terraform.io/downloads.html].
-
Optionally:
- For AWS infrastructure:
- Install AWS CLI in your machine: [https://aws.amazon.com/cli/].
- Verify or update AWS CLI credential: [https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html].
- For AWS infrastructure:
Installation
Installation of xTerraform is per project basis. So do the following:
-
Open terminal, change directory to current project root folder.
-
Install xTerraform:
composer require heyday/xterraform --dev
. -
Create folder to contain terraform templates, for example:
mkdir -p .xterraform/test
. -
Publish Terraform templates to desired directory:
cp -R vendor/heyday/xterraform/terraform/ .xterraform/test
. -
Navigate to that directory:
cd .xterraform/test
. -
Update
values.tfvars
as needed. -
Initialize Terraform:
terraform init
.
Optionally you can add
*.tf
to.gitignore
file, so all templates files will not be tracked by version control.
Application
- Apply infrastructure:
terraform apply -var-file=values.tfvars
Destruction
- Destroy infrastructure:
terraform destroy -var-file=values.tfvars