Following on from an earlier post: -
I can also choose to insert a whole block of text: -
cat insert.txt
backend "s3" {
bucket = "$bucket"
endpoint = "$endpoint"
force_path_style = true
skip_region_validation = true
skip_credentials_validation = true
skip_metadata_api_check = true
key = "$object"
region = "$REGION"
}
bucket = "$bucket"
endpoint = "$endpoint"
force_path_style = true
skip_region_validation = true
skip_credentials_validation = true
skip_metadata_api_check = true
key = "$object"
region = "$REGION"
}
into an existing Terraform file: -
cat version.tf
terraform {
required_providers {
aws = {
version = ">= 2.7.0"
source = "hashicorp/aws"
}
}
}
as follows: -
sed -i '/terraform {/ r insert.txt' version.tf
which gives us the following: -
cat version.tf
terraform {
backend "s3" {
bucket = "$bucket"
endpoint = "$endpoint"
force_path_style = true
skip_region_validation = true
skip_credentials_validation = true
skip_metadata_api_check = true
key = "$object"
region = "$REGION"
}
required_providers {
aws = {
version = ">= 2.7.0"
source = "hashicorp/aws"
}
}
}
Nice!
No comments:
Post a Comment