Closed MarcMeszaros closed 3 years ago
@MarcMeszaros as you can see my configuration is using Terragrunt with an s3 backend which is the most popular & recommended way of managing the Terraform state so please put it back into tf code.
I suggest you use the following format for the versions.tf & also it's safe to bump up the TF version to 0.14.10:
terraform {
backend "s3" {}
}
provider "aws" {
region = var.region
}
terraform {
required_version = ">= 0.14.10"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
tls = {
source = "hashicorp/tls"
version = "~> 3.0"
}
archive = {
source = "hashicorp/archive"
version = "~> 2.1"
}
null = {
source = "hashicorp/null"
version = "~> 3.0"
}
local = {
source = "hashicorp/local"
version = "~> 2.1"
}
}
}
@vainkop Added back the S3
backend for terragrunt users and refactored to have the versions.tf
as suggested. I also ran terraform fmt
on the module.
I had originally removed the backend because of this warning (terraform v0.15.3
) during plan
:
We use terraform cloud and we don't use terragrunt. We originally found this module via the terraform module registry. Is there a way to have defaults for terragrunt users without also throwing the warning for non terragrunt users using the module?
@vainkop Added back the
S3
backend for terragrunt users and refactored to have theversions.tf
as suggested. I also ranterraform fmt
on the module.
@MarcMeszaros I didn't mean to add all those providers into configuration, I just gave an example :) Please remove the ones which are not actually used. Thanks
We use terraform cloud and we don't use terragrunt. We originally found this module via the terraform module registry. Is there a way to have defaults for terragrunt users without also throwing the warning for non terragrunt users using the module?
A terragrunt.hcl similar to the following is usually used by terragrunt users for configuration of the backend: https://github.com/vainkop/terraform-aws-wireguard/blob/master/example/terragrunt.hcl#L4
A warning is not an error so shouldn't be a problem but it's not ideal I agree.
It's possible to use terragrunt with terraform cloud but the experience is limited:
@vainkop my mistake. I thought you literally wanted all the other dependencies in the versions.tf
. 😉
I also merged the s3
backend in the same terraform
declaration in versions.tf
.
I move the provider aws { }
to versions.tf
since it seems more related to module setup than the actual module implementation in main.tf
. Let me know if you actually want the aws provider declaration inside main.tf
.
The way the AWS provider minimum version was specified was causing version conflicts in my Terraform project. It is also using the deprecated method of declaring provider versions.
https://www.terraform.io/docs/language/providers/configuration.html#version-an-older-way-to-manage-provider-versions
The other change is the removal of the
S3
backend andterraform
config block. Since this is a public module consumed by other terraform workspaces, terraform ignores theS3
backend. In my particular case I don't useS3
for state management and use a different backend.