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

add grafana terraform definition and comment for accessing key #287

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

r33drichards
Copy link
Contributor

No description provided.

@r33drichards r33drichards changed the title Draft: grafana terraform add grafana terraform definition and comment for accessing key Feb 11, 2025
Copy link
Member

@jakubno jakubno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add e2b-grafana-cloud-access-policy-token in packages/init/main.tf

Also could you add e2b-grafana-username and fill with e2b-grafana-api-key if you run this terraform.

If you could copy the behavior in init, fill the new secret with " ", otherwise terraform fails while trying to read it

Could you also add Makefile, something like in #275

grafana/main.tf Outdated
resource "grafana_cloud_stack" "my_stack" {
provider = grafana.cloud

name = "e2b-stack"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use var.prefix as we do in all other places 🙏🏻

grafana/main.tf Outdated
service_account_id = grafana_cloud_stack_service_account.cloud_sa.id
}

# grafana_cloud_stack_service_account_token.cloud_sa.key // <-- how to get the key
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This goes to the GCP secret

grafana/main.tf Outdated Show resolved Hide resolved
grafana/main.tf Outdated
}

// Step 2: Create a service account and key for the stack
resource "grafana_cloud_stack_service_account" "cloud_sa" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this really needed, it seems to me you only need to create Access Policy token
terraform resource

packages/init/main.tf Outdated Show resolved Hide resolved
grafana/main.tf Outdated Show resolved Hide resolved
main.tf Outdated
@@ -245,3 +245,12 @@ module "nomad" {
# Redis
redis_port = var.redis_port
}


module "grafana" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it just as a separate module, it's only optional module and it can become very annoying

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, then maybe in the makefile have it be like make plan-grafana and make apply-grafana
?

# i think there is a incompatibility with wanting grafana to be in a different module
# and having the init module contain the secrets definitions. could move the
# secrets definitions here here though
module "init" {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jakubno does this comment track or am I missing something

@r33drichards
Copy link
Contributor Author

when testing, I'm running make plan in the project root to create the secrets, and I get the following error

╷
│ Error: error parsing jobspec: <nil>: Unset variable "grafana_logs_endpoint"; A used variable must be set or have a default value; see https://developer.hashicorp.com/nomad/docs/job-specification/hcl2/variables for details.
│ <nil>: Unset variable "grafana_logs_username"; A used variable must be set or have a default value; see https://developer.hashicorp.com/nomad/docs/job-specification/hcl2/variables for details.
│ 
│   with module.nomad.nomad_job.logs_collector,
│   on packages/nomad/main.tf line 131, in resource "nomad_job" "logs_collector":
│  131: resource "nomad_job" "logs_collector" {
│ 
╵
make: *** [plan] Error 1
➜  infra git:(grafana-tf) ✗    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants