Terraform infra code for Petclinic Project
Backend configuration
terraform init
-backend-config="key=dev/vpc.tfstate"
-backend-config="bucket=dcube-terraform-state"
-backend-config="region=us-west-2"
-backend-config="dynamodb_table=terraform-state-lock"
-var-file=../../vars/infra/dev/vpc.tfvars
terraform apply -var-file=../../vars/infra/dev/vpc.tfvars
terraform destroy
-backend-config="key=dev/vpc.tfstate"
-backend-config="bucket=dcube-terraform-state"
-backend-config="region=us-west-2"
-backend-config="dynamodb_table=terraform-state-lock"
-var-file=../../vars/infra/dev/vpc.tfvars
cd into the infra/vpc
directory and run the following commands:
- Init Terraform in the directory
infra/vpc
terraform init
- To preview the changes in code
terraform plan -var-file=../../vars/infra/dev/vpc.tfvars
- To apply the changes
terraform apply -var-file=../../vars/infra/dev/vpc.tfvars
- To destroy the resources created using the code
terraform destroy -var-file=../../vars/infra/dev/vpc.tfvars
cd into the platform/jenkins-controller
directory and run the following commands:
- Init Terraform in the directory
platform/jenkins-controller
terraform init
- To preview the changes in code
terraform plan -var-file=../../vars/platform/dev/jenkins-controller.tfvars
- To apply the changes
terraform apply -var-file=../../vars/platform/dev/jenkins-controller.tfvars
- To destroy the resources created using the code
terraform destroy -var-file=../../vars/platform/dev/jenkins-controller.tfvars
cd into the platform/jenkins-agent
directory and run the following commands:
- Init Terraform in the directory
platform/jenkins-agent
terraform init
- To preview the changes in code
terraform plan -var-file=../../vars/platform/dev/jenkins-agent.tfvars
- To apply the changes
terraform apply -var-file=../../vars/platform/dev/jenkins-agent.tfvars
- To destroy the resources created using the code
terraform destroy -var-file=../../vars/platform/dev/jenkins-agent.tfvars
cd into the platform/nexus
directory and run the following commands:
- Init Terraform in the directory `platform/nexus'
terraform init
- To preview the changes in code
terraform plan -var-file=../../vars/platform/dev/nexus.tfvars
- To apply the changes
terraform apply -var-file=../../vars/platform/dev/nexus.tfvars
- To destroy the resources created using the code
terraform destroy -var-file=../../vars/platform/dev/nexus.tfvars
cd into the platform/prometheus-grafana
directory and run the following commands:
- Init Terraform in the directory `platform/prometheus-grafana'
terraform init
- To preview the changes in code
terraform plan -var-file=../../vars/platform/dev/prometheus-grafana.tfvars
- To apply the changes
terraform apply -var-file=../../vars/platform/dev/prometheus-grafana.tfvars
- To destroy the resources created using the code
terraform destroy -var-file=../../vars/platform/dev/prometheus-grafana.tfvars
cd into the infra/backend
directory and run the following commands:
- Init Terraform in the directory `infra/backend'
terraform init
- To preview the changes in code
terraform plan -var-file=../../vars/infra/dev/backend.tfvars
- To apply the changes
terraform apply -var-file=../../vars/infra/dev/backend.tfvars
- To destroy the resources created using the code
terraform destroy -var-file=../../vars/infra/dev/backend.tfvars
cd into the infra/ecr
directory and run the following commands:
- Init Terraform in the directory `infra/ecr'
terraform init
- To preview the changes in code
terraform plan -var-file=../../vars/infra/dev/ecr.tfvars
- To apply the changes
terraform apply -var-file=../../vars/infra/dev/ecr.tfvars
- To destroy the resources created using the code
terraform destroy -var-file=../../vars/infra/dev/ecr.tfvars
cd into the platform/consul
directory and run the following commands:
- Init Terraform in the directory `platform/consul'
terraform init
- To preview the changes in code
terraform plan -var-file=../../vars/platform/dev/consul.tfvars
- To apply the changes
terraform apply -var-file=../../vars/platform/dev/consul.tfvars
- To destroy the resources created using the code
terraform destroy -var-file=../../vars/platform/dev/consul.tfvars