This project is an implementation of Terraform KMS Crypto Key Layout. It creates a KMS Crypto Key and the respective Keyring. Support also a list of service accounts to grant them permissions.
terraform {
backend "gcs" {
bucket = "my-foo-bucket-tfstate"
prefix = "kms"
}
required_version = ">= 0.12"
}
provider "google-beta" {
project = "my-foo-project"
region = "europe-west3"
zone = "europe-west3-c"
}
module "my_cool_kms_key" {
source = "./modules/terraform-google-kms"
name = "my-cool-kms-key"
location = "europe-west3"
project = "my-foo-project"
service_account = ["[email protected]"]
}
Variable name | Type | Description | Default value |
project | string | The ID of the project the resource belongs | |
location | string | Location of the cluster | |
name | string | The ID of the key and keyring | |
service_account | list(string) | A list of service accounts to grant permissions to that key |
$ terraform init
Terraform allows you to "Plan", which allows you to see what it would change without actually making any changes.
$ terraform plan
$ terraform apply
If you want to update service accounts, then edit the terraform.tfvars
file and run again terraform apply
$ terraform apply
$ terraform destroy
Georgios Kasapoglou
Copyright 2019 Georgios Kasapoglou
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.