mirror of
https://github.com/storytold/terraform-aws-observability-accelerator.git
synced 2026-10-09 00:09:43 +00:00
Move plan tests to AWS CodeBuild (#152)
* Add plan test on CodeBuild * (to revert) remove changes filter * (to revert) allow running on current branch * (to revert) run assume role always * Fix terraform state s3 keys for ci tests * Add defaults for e2e * Fix bucket name * Debug clone version * Pass build version * Use actions env syntax * fixup! Use actions env syntax * fixup! fixup! Use actions env syntax * fixup! fixup! fixup! Use actions env syntax * Add input for amp monitoring * Update e2e cluster name * use credentials v2 * Cleanup * Add build badge * Revert triggers settings
This commit is contained in:
@@ -75,7 +75,7 @@ jobs:
|
|||||||
- '*.tf'
|
- '*.tf'
|
||||||
|
|
||||||
- name: Configure AWS credentials from Test account
|
- name: Configure AWS credentials from Test account
|
||||||
uses: aws-actions/configure-aws-credentials@v1
|
uses: aws-actions/configure-aws-credentials@v2
|
||||||
if: steps.changes.outputs.src== 'true'
|
if: steps.changes.outputs.src== 'true'
|
||||||
with:
|
with:
|
||||||
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
|
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
|
||||||
@@ -83,21 +83,34 @@ jobs:
|
|||||||
role-duration-seconds: 3600
|
role-duration-seconds: 3600
|
||||||
role-session-name: GithubActions-Session
|
role-session-name: GithubActions-Session
|
||||||
|
|
||||||
- name: Terraform Job
|
- name: Terraform plan from CodeBuild
|
||||||
uses: hashicorp/setup-terraform@v2
|
|
||||||
if: steps.changes.outputs.src== 'true'
|
if: steps.changes.outputs.src== 'true'
|
||||||
|
uses: aws-actions/aws-codebuild-run-build@v1
|
||||||
|
env:
|
||||||
|
TF_VAR_aws_region: us-west-2
|
||||||
|
TF_VAR_managed_grafana_workspace_id: ${{ secrets.GRAFANA_WORKSPACE_ID }}
|
||||||
|
TF_VAR_eks_cluster_id: e2e-tests
|
||||||
|
TF_VAR_managed_prometheus_workspace_ids: ${{ secrets.PROMETHEUS_WORKSPACE_ID }}
|
||||||
with:
|
with:
|
||||||
terraform_version: 1.2.9
|
project-name: terraform-plan
|
||||||
|
disable-source-override: false
|
||||||
- if: steps.changes.outputs.src== 'true'
|
env-vars-for-codebuild: |
|
||||||
run: terraform version
|
TF_VAR_aws_region,
|
||||||
|
TF_VAR_managed_grafana_workspace_id,
|
||||||
- name: Terraform Init
|
TF_VAR_eks_cluster_id,
|
||||||
if: steps.changes.outputs.src== 'true'
|
TF_VAR_managed_prometheus_workspace_ids
|
||||||
run: terraform init -reconfigure
|
buildspec-override: |
|
||||||
working-directory: ${{ matrix.directory }}
|
version: 0.2
|
||||||
|
phases:
|
||||||
- name: Terraform Plan
|
build:
|
||||||
if: steps.changes.outputs.src== 'true'
|
commands:
|
||||||
working-directory: ${{ matrix.directory }}
|
- export TF_VAR_grafana_api_key="fakeapikey"
|
||||||
run: terraform plan -no-color
|
- curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
|
||||||
|
- sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
|
||||||
|
- sudo apt-get update && sudo apt-get install terraform
|
||||||
|
- terraform -version
|
||||||
|
- aws --version
|
||||||
|
- cd ${{ matrix.directory }}
|
||||||
|
- sed -i 's/#//' versions.tf
|
||||||
|
- terraform init
|
||||||
|
- terraform plan
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# AWS Observability Accelerator for Terraform
|
# AWS Observability Accelerator for Terraform
|
||||||
|
|
||||||
[](https://github.com/aws-observability/terraform-aws-observability-accelerator/actions/workflows/pre-commit.yaml)
|
[](https://github.com/aws-observability/terraform-aws-observability-accelerator/actions/workflows/pre-commit.yaml)
|
||||||
|
[](https://github.com/aws-observability/terraform-aws-observability-accelerator/actions/workflows/plan-examples.yml)
|
||||||
|
|
||||||
Welcome to the AWS Observability Accelerator for Terraform!
|
Welcome to the AWS Observability Accelerator for Terraform!
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
variable "cluster_name" {
|
variable "cluster_name" {
|
||||||
description = "Name of cluster - used by Terratest for e2e test automation"
|
description = "Name of cluster - used by Terratest for e2e test automation"
|
||||||
type = string
|
type = string
|
||||||
default = ""
|
default = "eks-cluster-with-vpc"
|
||||||
|
|
||||||
validation {
|
validation {
|
||||||
# cluster name is used as prefix on eks_blueprint module and cannot be >25 characters
|
# cluster name is used as prefix on eks_blueprint module and cannot be >25 characters
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ terraform {
|
|||||||
|
|
||||||
# ## Used for end-to-end testing on project; update to suit your needs
|
# ## Used for end-to-end testing on project; update to suit your needs
|
||||||
# backend "s3" {
|
# backend "s3" {
|
||||||
# bucket = "observability-accelerator-terraform-states"
|
# bucket = "aws-observability-accelerator-terraform-states"
|
||||||
# region = "us-west-2"
|
# region = "us-west-2"
|
||||||
# key = "e2e/eks-cluster-with-vpc/terraform.tfstate"
|
# key = "e2e/eks-cluster-with-vpc/terraform.tfstate"
|
||||||
# }
|
# }
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ terraform {
|
|||||||
|
|
||||||
# ## Used for end-to-end testing on project; update to suit your needs
|
# ## Used for end-to-end testing on project; update to suit your needs
|
||||||
# backend "s3" {
|
# backend "s3" {
|
||||||
# bucket = "observability-accelerator-terraform-states"
|
# bucket = "aws-observability-accelerator-terraform-states"
|
||||||
# region = "us-west-2"
|
# region = "us-west-2"
|
||||||
# key = "e2e/existing-cluster-with-base-and-infra/terraform.tfstate"
|
# key = "e2e/existing-cluster-java/terraform.tfstate"
|
||||||
# }
|
# }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ terraform {
|
|||||||
|
|
||||||
# ## Used for end-to-end testing on project; update to suit your needs
|
# ## Used for end-to-end testing on project; update to suit your needs
|
||||||
# backend "s3" {
|
# backend "s3" {
|
||||||
# bucket = "observability-accelerator-terraform-states"
|
# bucket = "aws-observability-accelerator-terraform-states"
|
||||||
# region = "us-west-2"
|
# region = "us-west-2"
|
||||||
# key = "e2e/existing-cluster-with-base-and-infra/terraform.tfstate"
|
# key = "e2e/existing-cluster-nginx/terraform.tfstate"
|
||||||
# }
|
# }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ terraform {
|
|||||||
|
|
||||||
# ## Used for end-to-end testing on project; update to suit your needs
|
# ## Used for end-to-end testing on project; update to suit your needs
|
||||||
# backend "s3" {
|
# backend "s3" {
|
||||||
# bucket = "observability-accelerator-terraform-states"
|
# bucket = "aws-observability-accelerator-terraform-states"
|
||||||
# region = "us-west-2"
|
# region = "us-west-2"
|
||||||
# key = "e2e/existing-cluster-with-base-and-infra/terraform.tfstate"
|
# key = "e2e/existing-cluster-with-base-and-infra/terraform.tfstate"
|
||||||
# }
|
# }
|
||||||
|
|||||||
@@ -7,4 +7,11 @@ terraform {
|
|||||||
version = ">= 4.0.0"
|
version = ">= 4.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ## Used for end-to-end testing on project; update to suit your needs
|
||||||
|
# backend "s3" {
|
||||||
|
# bucket = "aws-observability-accelerator-terraform-states"
|
||||||
|
# region = "us-west-2"
|
||||||
|
# key = "e2e/managed-grafana-workspace/terraform.tfstate"
|
||||||
|
# }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,11 @@ terraform {
|
|||||||
version = ">= 1.25.0"
|
version = ">= 1.25.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ## Used for end-to-end testing on project; update to suit your needs
|
||||||
|
# backend "s3" {
|
||||||
|
# bucket = "aws-observability-accelerator-terraform-states"
|
||||||
|
# region = "us-west-2"
|
||||||
|
# key = "e2e/managed-prometheus-monitoring/terraform.tfstate"
|
||||||
|
# }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user