Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: App Token not passing to child module #2230

Open
1 task done
coreyd-valcre opened this issue Apr 12, 2024 · 0 comments
Open
1 task done

[BUG]: App Token not passing to child module #2230

coreyd-valcre opened this issue Apr 12, 2024 · 0 comments
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@coreyd-valcre
Copy link

Expected Behavior

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 3.80.0"
    }
    azuread = {
      source  = "hashicorp/azuread"
      version = ">= 2.47.0"
    }
    github = {
      source  = "integrations/github"
      version = "~> 6.0"
    }
  }
}

provider "azurerm" {
  features {
    resource_group {
      prevent_deletion_if_contains_resources = false
    }
    key_vault {
      purge_soft_delete_on_destroy = true
    }
  }
  skip_provider_registration = false
}

provider "azuread" {

}

provider "github" {
  token = var.github_token
  owner = "SecretCo"
}

module "gha-dpl-env-client-id-add" {
  depends_on      = [module.gha-dpl-identity-sp]
  source          = "git::https://github.com/SecretCo/SecretRepo.git//Github/Actions/Environment/Secret?ref=feature/github-secret"
  repository_name = "SecretRepo"
  environment     = "development"
  secret_name     = "AZURE_CLIENT_ID"
  secret_value    = module.gha-dpl-identity-sp.service_principal_id
}

This should connect to the secret (also variable in a seperate module doing the same thing) module in the child and create my secret.

Actual Behavior

I recieve a 404 on the repo as it does not seem to be passing the token to the child module. Note that in the child module I do have:

terraform {
  required_providers {
    github = {
      source  = "integrations/github"
      version = "~> 6.0"
    }
  }
}

Listed so it knows to use the correct github. If I add a provider block in the child, it acts as if it is using the hashicorp source until I remove it. No matter what changes I make I cannot seem to get around the 404 and I am not sure what additional steps to take to ensure that my token is passed properly.

Do note, I am logging in using a Github App and converting the app_id and app_password to a token which does log into the CLI in an earlier phase.

Terraform Version

Terraform 1.8.0 on darwin arm64 (MACOS)

Affected Resource(s)

  • github_actions_environment_secret
  • github_actions_environment_variable

Terraform Configuration Files

No response

Steps to Reproduce

terraform apply -tfplan ./tfplan

Debug Output

2024-04-12T16:11:36.9939336Z 2024-04-12T16:11:19.366Z [ERROR] provider.terraform-provider-github_v6.2.1: Response contains error diagnostic: diagnostic_severity=ERROR diagnostic_summary="GET https://api.github.com/repos/SecretCo/MyRepo: 404 Not Found []" tf_provider_addr=provider tf_req_id=2a45f0d2-a6b3-c79c-3aa0-bf314fdf6b9f tf_resource_type=github_actions_environment_secret @caller=github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_detail="" tf_rpc=ApplyResourceChange tf_proto_version=5.4 @module=sdk.proto timestamp=2024-04-12T16:11:19.366Z

2024-04-12T16:11:36.9961465Z 2024-04-12T16:11:19.367Z [ERROR] vertex "module.gha-dpl-env-client-id-add.github_actions_environment_secret.secret" error: GET https://api.github.com/repos/SecretCo/SecretRepo: 404 Not Found []

Panic Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@coreyd-valcre coreyd-valcre added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Apr 12, 2024
@kfcampbell kfcampbell added Status: Up for grabs Issues that are ready to be worked on by anyone and removed Status: Triage This is being looked at and prioritized labels Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

2 participants