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'
|
||||
|
||||
- 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'
|
||||
with:
|
||||
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
|
||||
@@ -83,21 +83,34 @@ jobs:
|
||||
role-duration-seconds: 3600
|
||||
role-session-name: GithubActions-Session
|
||||
|
||||
- name: Terraform Job
|
||||
uses: hashicorp/setup-terraform@v2
|
||||
- name: Terraform plan from CodeBuild
|
||||
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:
|
||||
terraform_version: 1.2.9
|
||||
|
||||
- if: steps.changes.outputs.src== 'true'
|
||||
run: terraform version
|
||||
|
||||
- name: Terraform Init
|
||||
if: steps.changes.outputs.src== 'true'
|
||||
run: terraform init -reconfigure
|
||||
working-directory: ${{ matrix.directory }}
|
||||
|
||||
- name: Terraform Plan
|
||||
if: steps.changes.outputs.src== 'true'
|
||||
working-directory: ${{ matrix.directory }}
|
||||
run: terraform plan -no-color
|
||||
project-name: terraform-plan
|
||||
disable-source-override: false
|
||||
env-vars-for-codebuild: |
|
||||
TF_VAR_aws_region,
|
||||
TF_VAR_managed_grafana_workspace_id,
|
||||
TF_VAR_eks_cluster_id,
|
||||
TF_VAR_managed_prometheus_workspace_ids
|
||||
buildspec-override: |
|
||||
version: 0.2
|
||||
phases:
|
||||
build:
|
||||
commands:
|
||||
- export TF_VAR_grafana_api_key="fakeapikey"
|
||||
- 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
|
||||
|
||||
[](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!
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
variable "cluster_name" {
|
||||
description = "Name of cluster - used by Terratest for e2e test automation"
|
||||
type = string
|
||||
default = ""
|
||||
default = "eks-cluster-with-vpc"
|
||||
|
||||
validation {
|
||||
# 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
|
||||
# backend "s3" {
|
||||
# bucket = "observability-accelerator-terraform-states"
|
||||
# bucket = "aws-observability-accelerator-terraform-states"
|
||||
# region = "us-west-2"
|
||||
# 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
|
||||
# backend "s3" {
|
||||
# bucket = "observability-accelerator-terraform-states"
|
||||
# bucket = "aws-observability-accelerator-terraform-states"
|
||||
# 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
|
||||
# backend "s3" {
|
||||
# bucket = "observability-accelerator-terraform-states"
|
||||
# bucket = "aws-observability-accelerator-terraform-states"
|
||||
# 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
|
||||
# backend "s3" {
|
||||
# bucket = "observability-accelerator-terraform-states"
|
||||
# bucket = "aws-observability-accelerator-terraform-states"
|
||||
# region = "us-west-2"
|
||||
# key = "e2e/existing-cluster-with-base-and-infra/terraform.tfstate"
|
||||
# }
|
||||
|
||||
@@ -7,4 +7,11 @@ terraform {
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
# ## 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