https://github.com/dmrhimali/terraform
Tutorial on how to create and run terraform scripts for providers aws and newrelic
https://github.com/dmrhimali/terraform
aws-batch aws-cloudwatch aws-emr aws-glue newrelic spark terraform
Last synced: 7 months ago
JSON representation
Tutorial on how to create and run terraform scripts for providers aws and newrelic
- Host: GitHub
- URL: https://github.com/dmrhimali/terraform
- Owner: dmrhimali
- Created: 2025-01-02T03:29:50.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-01-02T03:48:31.000Z (9 months ago)
- Last Synced: 2025-01-13T01:14:15.160Z (9 months ago)
- Topics: aws-batch, aws-cloudwatch, aws-emr, aws-glue, newrelic, spark, terraform
- Language: HCL
- Homepage:
- Size: 20.6 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
## Terraform
This project contains multiple terraform sscripts:
- [apm-newrelic-monitoring](apm-newrelic-monitoring)
- [aws-batch](aws-batch)
- [aws-emr-spark](aws-emr-spark)
- [aws-glue](aws-glue)
- [es-cloudwatch-monitoring](es-cloudwatch-monitoring)
- [es-newrelic-monitoring](es-newrelic-monitoring)
-## Gitlab pipeline to run terraform
**gitlab pipeline**```yml
image: git.dmrh.com:4567/docker-images/terraformstages:
- plan
- apply.plan:
before_script:
- git clone https://ci_service:$CI_SERVICE_PASSWORD@bitbucket.dmrh.com/scm/far/terraform.git
- git clone https://gitlab+deploy-token-2:$CI_VARS_DEPLOY_TOKEN@git.dmrh.com/operations/amazon-machine-images/ci-variables.git
- source ci-variables/$env
- cd terraform/environments/$env
- echo "Environment:" $env
- echo "Target to plan:" $TARGET
script:
- terraform init
- terraform plan -target module.$TARGET -out=tfplan -lock=false -input=false
only:
variables:
- $TARGET
tags:
- docker
- ops.apply:
before_script:
- git clone https://ci_service:$CI_SERVICE_PASSWORD@bitbucket.dmrh.com/scm/far/terraform.git tmp
- git clone https://gitlab+deploy-token-2:$CI_VARS_DEPLOY_TOKEN@git.dmrh.com/operations/amazon-machine-images/ci-variables.git
- mv tmp/* terraform/*
- source ci-variables/$env
- cd terraform/environments/$env
- echo "Environment:" $env
- echo "Applying Target:" $TARGET
script:
- terraform apply tfplan
only:
variables:
- $TARGET
tags:
- docker
- opsLOCAL Plan:
extends: .plan
stage: plan
variables:
env: local
when: manual
artifacts:
expire_in: 1h
paths:
- terraform/environments/$env/.terraform
- terraform/environments/$env/tfplanLOCAL Apply:
extends: .apply
stage: apply
variables:
env: local
needs: ["LOCAL Plan"]
dependencies:
- LOCAL Plan
when: manualDEV Plan:
extends: .plan
stage: plan
variables:
env: dev
when: manual
artifacts:
expire_in: 1h
paths:
- terraform/environments/$env/.terraform
- terraform/environments/$env/tfplanDEV Apply:
extends: .apply
stage: apply
variables:
env: dev
needs: ["DEV Plan"]
dependencies:
- DEV Plan
when: manualQA Plan:
extends: .plan
stage: plan
variables:
env: qa
when: manual
artifacts:
expire_in: 1h
paths:
- terraform/environments/$env/.terraform
- terraform/environments/$env/tfplanQA Apply:
extends: .apply
stage: apply
variables:
env: qa
needs: ["QA Plan"]
dependencies:
- QA Plan
when: manual```