NEW: setup remote state and lock
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
resource "random_integer" "suffix" {
|
||||
min = 1000
|
||||
max = 9999
|
||||
}
|
||||
|
||||
resource "aws_s3_bucket" "state" {
|
||||
bucket = "tfstate-sandbox-hkex-${random_integer.suffix.result}"
|
||||
force_destroy = true
|
||||
|
||||
tags = var.default-tags
|
||||
|
||||
versioning {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
server_side_encryption_configuration {
|
||||
rule {
|
||||
apply_server_side_encryption_by_default {
|
||||
sse_algorithm = "AES256"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_dynamodb_table" "statelock-sandbox-HKEX" {
|
||||
name = "statelock-sandbox-HKEX-${random_integer.suffix.result}"
|
||||
read_capacity = 20
|
||||
write_capacity = 20
|
||||
hash_key = "LockId"
|
||||
|
||||
attribute {
|
||||
name = "LockId"
|
||||
type = "S"
|
||||
}
|
||||
|
||||
tags = var.default-tags
|
||||
}
|
||||
|
||||
output "state_bucket" {
|
||||
value = aws_s3_bucket.state.bucket
|
||||
}
|
||||
|
||||
output "lock_db" {
|
||||
value = aws_dynamodb_table.statelock-sandbox-HKEX.name
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
variable "aws_access_key" {}
|
||||
variable "aws_secret_key" {}
|
||||
variable "aws_region" {}
|
||||
|
||||
provider "aws" {
|
||||
access_key = var.aws_access_key
|
||||
secret_key = var.aws_secret_key
|
||||
region = var.aws_region
|
||||
version = ">= 2.28.1"
|
||||
}
|
||||
|
||||
variable "default-tags" {}
|
||||
variable "vpc-cidr" {
|
||||
default = "172.16.0.0/16"
|
||||
}
|
||||
Reference in New Issue
Block a user