cds-snc / notification-terraform

Terraform for notification.canada.ca
MIT License
13 stars 6 forks source link

Xray Take 2 #1473

Closed P0NDER0SA closed 1 month ago

P0NDER0SA commented 1 month ago

Summary | Résumé

Adding the IAM work for K8s/EKS to allow XRay to connect and monitor our clusters. This wont work yet without a Daemon pod deployed.

Related Issues | Cartes liées

Tracing / correlate requests through the Notify components (AWS X-Ray)

Test instructions | Instructions pour tester la modification

Watch the Terraform Plans and Applys. We can't know if this actually works until we have a daemon.

Release Instructions | Instructions pour le déploiement

None.

Reviewer checklist | Liste de vérification du réviseur

⚠ If boxes cannot be checked off before merging the PR, they should be moved to the "Release Instructions" section with appropriate steps required to verify before release. For example, changes to celery code may require tests on staging to verify that performance has not been affected.

github-actions[bot] commented 1 month ago

Staging: eks

✅   Terraform Init: success ✅   Terraform Validate: success ✅   Terraform Format: success ✅   Terraform Plan: success ✅   Conftest: success

⚠️   Warning: resources will be destroyed by this change!

Plan: 2 to add, 1 to change, 2 to destroy
Show summary | CHANGE | NAME | |----------|-------------------------------------------------------| | update | `aws_iam_policy.xray_policy` | | recreate | `aws_iam_instance_profile.nodes_k8s_instance_profile` | | | `aws_iam_role.nodes_k8s_role` |
Show plan ```terraform Resource actions are indicated with the following symbols: ~ update in-place -/+ destroy and then create replacement Terraform will perform the following actions: # aws_iam_instance_profile.nodes_k8s_instance_profile must be replaced -/+ resource "aws_iam_instance_profile" "nodes_k8s_instance_profile" { ~ arn = "arn:aws:iam::239043911459:instance-profile/nodes.k8s.cluster.staging" -> (known after apply) ~ create_date = "2024-07-26T14:36:05Z" -> (known after apply) ~ id = "nodes.k8s.cluster.staging" -> (known after apply) ~ name = "nodes.k8s.cluster.staging" -> "nodes.k8s.cluster.local" # forces replacement + name_prefix = (known after apply) ~ role = "nodes.k8s.cluster.staging" -> "nodes.k8s.cluster.local" - tags = {} -> null ~ tags_all = {} -> (known after apply) ~ unique_id = "AIPATPKBAT4RYQQJZVMRA" -> (known after apply) # (1 unchanged attribute hidden) } # aws_iam_policy.xray_policy will be updated in-place ~ resource "aws_iam_policy" "xray_policy" { id = "arn:aws:iam::239043911459:policy/XRayPolicy" name = "XRayPolicy" ~ policy = jsonencode( ~ { ~ Statement = [ ~ { ~ Resource = [ - "arn:aws:iam::239043911459:instance-profile/nodes.k8s.cluster.staging", + "arn:aws:iam::239043911459:instance-profile/nodes.k8s.cluster.local", ] # (2 unchanged attributes hidden) }, ] # (1 unchanged attribute hidden) } ) tags = {} # (5 unchanged attributes hidden) } # aws_iam_role.nodes_k8s_role must be replaced -/+ resource "aws_iam_role" "nodes_k8s_role" { ~ arn = "arn:aws:iam::239043911459:role/nodes.k8s.cluster.staging" -> (known after apply) ~ create_date = "2024-07-26T14:36:05Z" -> (known after apply) ~ id = "nodes.k8s.cluster.staging" -> (known after apply) ~ managed_policy_arns = [] -> (known after apply) ~ name = "nodes.k8s.cluster.staging" -> "nodes.k8s.cluster.local" # forces replacement + name_prefix = (known after apply) - tags = {} -> null ~ tags_all = {} -> (known after apply) ~ unique_id = "AROATPKBAT4RVHLBFIFYL" -> (known after apply) # (4 unchanged attributes hidden) } Plan: 2 to add, 1 to change, 2 to destroy. ───────────────────────────────────────────────────────────────────────────── Saved the plan to: plan.tfplan To perform exactly these actions, run the following command to apply: terraform apply "plan.tfplan" ```
Show Conftest results ```sh WARN - plan.json - main - Cloudwatch log metric pattern is invalid: ["aws_cloudwatch_log_metric_filter.celery-error[0]"] WARN - plan.json - main - Cloudwatch log metric pattern is invalid: ["aws_cloudwatch_log_metric_filter.scanfiles-timeout[0]"] WARN - plan.json - main - Missing Common Tags: ["aws_acm_certificate.client_vpn"] WARN - plan.json - main - Missing Common Tags: ["aws_acm_certificate.notification-canada-ca"] WARN - plan.json - main - Missing Common Tags: ["aws_acm_certificate.notification-canada-ca-alt[0]"] WARN - plan.json - main - Missing Common Tags: ["aws_alb.notification-canada-ca"] WARN - plan.json - main - Missing Common Tags: ["aws_alb_listener.internal_alb_tls"] WARN - plan.json - main - Missing Common Tags: ["aws_alb_listener.notification-canada-ca"] WARN - plan.json - main - Missing Common Tags: ["aws_alb_target_group.internal_nginx_http"] WARN - plan.json - main - Missing Common Tags: ["aws_alb_target_group.notification-canada-ca-admin"] WARN - plan.json - main - Missing Common Tags: ["aws_alb_target_group.notification-canada-ca-api"] WARN - plan.json - main - Missing Common Tags: ["aws_alb_target_group.notification-canada-ca-document"] WARN - plan.json - main - Missing Common Tags: ["aws_alb_target_group.notification-canada-ca-document-api"] WARN - plan.json - main - Missing Common Tags: ["aws_alb_target_group.notification-canada-ca-documentation"] WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.notification-canada-ca-eks-application-logs[0]"] WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.notification-canada-ca-eks-cluster-logs[0]"] WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.notification-canada-ca-eks-prometheus-logs[0]"] WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.admin-evicted-pods[0]"] WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.admin-pods-high-cpu-warning[0]"] WARN - plan.json - main -... ```