Closed BartoszZawadzki closed 1 year ago
Could you double-check that terragrunt init
actually downloads the module in the cache location? Try to delete it and rerun it if you haven't done it yet.
.terragrunt-cache/lNn_BUItOxjt46sMF85eiWlKVAc/eWDEKADBpIQ7X8Dom0nJ14Prazg
β― ls -alh
total 152
drwxr-xr-x 18 bartoszzawadzki staff 576B Oct 27 12:17 .
drwxr-xr-x 3 bartoszzawadzki staff 96B Oct 27 12:17 ..
-rw-r--r-- 1 bartoszzawadzki staff 559B Oct 27 12:17 .editorconfig
drwxr-xr-x 12 bartoszzawadzki staff 384B Oct 27 13:15 .git
drwxr-xr-x 3 bartoszzawadzki staff 96B Oct 27 12:17 .github
-rw-r--r-- 1 bartoszzawadzki staff 913B Oct 27 12:17 .gitignore
-rw-r--r-- 1 bartoszzawadzki staff 1.2K Oct 27 12:17 .pre-commit-config.yaml
-rw-r--r-- 1 bartoszzawadzki staff 1.0K Oct 27 12:17 .releaserc.json
-rw-r----- 1 bartoszzawadzki staff 27B Oct 27 12:17 .terragrunt-source-version
-rw-r--r-- 1 bartoszzawadzki staff 2.6K Oct 27 12:17 CHANGELOG.md
-rw-r--r-- 1 bartoszzawadzki staff 9.9K Oct 27 12:17 LICENSE
-rw-r--r-- 1 bartoszzawadzki staff 13K Oct 27 12:17 README.md
drwxr-xr-x 4 bartoszzawadzki staff 128B Oct 27 12:17 examples
-rw-r--r-- 1 bartoszzawadzki staff 7.9K Oct 27 12:17 main.tf
-rw-r--r-- 1 bartoszzawadzki staff 773B Oct 27 12:17 outputs.tf
-rw-r--r-- 1 bartoszzawadzki staff 6.1K Oct 27 12:17 variables.tf
-rw-r--r-- 1 bartoszzawadzki staff 151B Oct 27 12:17 versions.tf
drwxr-xr-x 13 bartoszzawadzki staff 416B Oct 27 13:15 wrappers
I can't reproduce it after running your provided terragrunt.hcl
config. Here is an output:
$ terragrunt init
Initializing modules...
Initializing the backend...
Initializing provider plugins...
- Reusing previous version of hashicorp/aws from the dependency lock file
- Using previously-installed hashicorp/aws v4.36.1
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
$ terragrunt plan
module.wrapper["activity_sec"].data.aws_caller_identity.current: Reading...
module.wrapper["activity_sec"].data.aws_partition.current: Reading...
module.wrapper["activity_sec"].data.aws_partition.current: Read complete after 0s [id=aws]
module.wrapper["activity_sec"].data.aws_caller_identity.current: Read complete after 1s [id=835367859851]
module.wrapper["activity_sec"].data.aws_iam_policy_document.repository[0]: Reading...
module.wrapper["activity_sec"].data.aws_iam_policy_document.repository[0]: Read complete after 0s [id=1015195856]
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# module.wrapper["activity_sec"].aws_ecr_lifecycle_policy.this[0] will be created
+ resource "aws_ecr_lifecycle_policy" "this" {
+ id = (known after apply)
+ policy = jsonencode(
{
+ rules = [
+ {
+ action = {
+ type = "expire"
}
+ description = "Keep last 30 images"
+ rulePriority = 1
+ selection = {
+ countNumber = 30
+ countType = "imageCountMoreThan"
+ tagPrefixList = [
+ "v",
]
+ tagStatus = "tagged"
}
},
]
}
)
+ registry_id = (known after apply)
+ repository = "foo"
}
# module.wrapper["activity_sec"].aws_ecr_repository.this[0] will be created
+ resource "aws_ecr_repository" "this" {
+ arn = (known after apply)
+ id = (known after apply)
+ image_tag_mutability = "IMMUTABLE"
+ name = "foo"
+ registry_id = (known after apply)
+ repository_url = (known after apply)
+ tags = {
+ "Environment" = "dd"
+ "Terraform" = "true"
}
+ tags_all = {
+ "Environment" = "dd"
+ "Terraform" = "true"
}
+ encryption_configuration {
+ encryption_type = "AES256"
+ kms_key = (known after apply)
}
+ image_scanning_configuration {
+ scan_on_push = true
}
}
# module.wrapper["activity_sec"].aws_ecr_repository_policy.this[0] will be created
+ resource "aws_ecr_repository_policy" "this" {
+ id = (known after apply)
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "ecr:ListTagsForResource",
+ "ecr:ListImages",
+ "ecr:GetRepositoryPolicy",
+ "ecr:GetLifecyclePolicyPreview",
+ "ecr:GetLifecyclePolicy",
+ "ecr:GetDownloadUrlForLayer",
+ "ecr:DescribeRepositories",
+ "ecr:DescribeImages",
+ "ecr:DescribeImageScanFindings",
+ "ecr:BatchGetImage",
+ "ecr:BatchCheckLayerAvailability",
]
+ Effect = "Allow"
+ Principal = {
+ AWS = "arn:aws:iam::835367859851:root"
}
+ Sid = "PrivateReadOnly"
},
]
+ Version = "2012-10-17"
}
)
+ registry_id = (known after apply)
+ repository = "foo"
}
Plan: 3 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ wrapper = {
+ activity_sec = {
+ repository_arn = (known after apply)
+ repository_registry_id = (known after apply)
+ repository_url = (known after apply)
}
}
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.
Alright, so I've been able to catch the issue. I was using TerraformCloud as a backend:
generate "backend" {
path = "backend.tf"
if_exists = "overwrite_terragrunt"
contents = <<EOF
terraform {
backend "remote" {
hostname = "app.terraform.io"
organization = "MyOrganization"
token = "${local.terraform_token}"
workspaces {
name = "MyOrganization-${local.environment}"
}
}
}
EOF
}
when switched to s3 backend plan generated successfully.
Thanks for Your help Anton!
I'm going to lock this issue because it has been closed for 30 days β³. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
I'm trying to use wrappers to create some repositories in ECR, currently I want to create just one. My config:
Output when executing
terragrunt plan
:β οΈ Note
Before you submit an issue, please perform the following first:
.terraform
directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!):rm -rf .terraform/
terraform init
Versions
Module version [Required]: 1.4.0
Terraform version: Terraform v1.3.3
Provider version(s): registry.terraform.io/hashicorp/aws v4.36.1
Reproduction Code [Required]
Steps to reproduce the behavior:
Yes Yes In description ## Expected behavior terragrunt plan passes successfully ## Actual behavior In description ### Terminal Output Screenshot(s)Additional context