[BUG]: Argument repository doesn't pass when used with count on module
Expected Behavior
Argument repository should be detected.
Actual Behavior
Argument repository is not detected.
Terraform Version
Terraform v1.8.1 on darwin_arm64
- provider regsitry.terraform/integrations/github v6.2.1
Affected Resource(s)
- github_actions_environment_secret
Terraform Configuration Files
No response
Steps to Reproduce
I encounter this issue. So, I create terraform module to import secret from vault to github environment:
data "github_repository" "repo" {
full_name = "${var.github_owner}/${var.github_repository}"
}
data "vault_generic_secret" "github_env_secret" {
path = var.vault_secret_path
}
locals {
secrets_map = jsondecode(data.vault_generic_secret.github_env_secret.data_json)
}
resource "github_repository_environment" "environment" {
repository = var.github_repository
environment = var.github_environment
}
resource "github_actions_environment_secret" "secrets" {
count = length(keys(local.secrets_map))
repository = data.github_repository.repo.name
environment = github_repository_environment.environment.environment
secret_name = element(keys(local.secrets_map), count.index)
plaintext_value = element(values(local.secrets_map), count.index)
}
And then I use the module on my tf script:
module "github_secret" {
source = "path/to/module"
github_environment = "Test"
github_repository = "demo-repo"
vault_secret_path = "github/myorg/demo-repo/secrets"
}
Debug Output
╷
│ Error: Missing required argument
│
│ with module.github_secret.github_actions_environment_secret.secrets[0],
│ on .terraform/modules/github_secret/github-env-vault/main.tf line 25, in resource "github_actions_environment_secret" "secrets":
│ 25: repository = data.github_repository.repo.name
│
│ The argument "repository" is required, but no definition was found.
╵
Panic Output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
x2 on this, same issue with for_each
│ Error: Missing required argument
│
│ with github_repository_webhook.pr["sports-wiki"],
│ on main.tf line 101, in resource "github_repository_webhook" "pr":
│ 101: repository = data.github_repository.this["${each.value.id}"].name
│
│ The argument "repository" is required, but no definition was found.
👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!
The time has come again to pay our tribute of spam to the spambot, for it has been a few months.
Behold this sacred offering of a pointless bump. May the ~~Gods~~ Bots hear our prayers, and may the acursed Stale status forelet this Issue.
Thank you for your contributions and help in keeping things tidy.