Skip to content

Commit

Permalink
add state bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelnikolov committed Jul 25, 2024
1 parent f865c98 commit fee7a89
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/terraform-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
contents: read
id-token: write
pull-requests: write

env:
TF_VAR_state_bucket: ${{ secrets.TF_VAR_STATE_BUCKET }}
steps:
- uses: actions/checkout@v4

Expand Down
16 changes: 14 additions & 2 deletions terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
provider "aws" {
region = var.aws_region
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}

backend "s3" {
bucket = var.state_bucket
key = "terraform/eks/terraform.tfstate"
region = var.aws_region
}
}


resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
}
Expand Down
5 changes: 5 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ variable "aws_region" {
description = "AWS region"
default = "eu-central-1"
type = string
}

variable "state_bucket" {
description = "S3 bucket for Terraform state"
type = string
}

0 comments on commit fee7a89

Please sign in to comment.