Cert prep · Terraform Authoring and Operations Pro · AWS DevOps Engineer Pro (DOP-C02) · CKA · CKS

Secrets, trust and cluster hardening

Practice self-check. Answers stay in this page so you can grade yourself. This is not a scored exam.

Twelve questions. Objectives: Terraform Pro 2 and 6; DOP-C02 tasks 6.1, 6.2 and 6.3; CKA cluster architecture and servicing and networking; CKS cluster hardening, microservice vulnerabilities, supply chain and runtime security. Companion lab: Terraform lab 12, sensitive values and credentials.

Lab download. Starter is the tree you edit. Worked answer is a separate file; open it after the starter passes. Terraform exactly 1.10.5 and one download of hashicorp/aws 6.71.0. Mock provider: no credentials and no cloud spend. The starter's hx-lab12-not-a-real-key, hx-lab12-not-a-real-secret, and hx-lab12-change-me values are fake defaults the exercise tells you to remove. All lab requirements.

Q1 · Terraform Pro objective 2, sensitive outputs
A configuration declares the output db_connection_string with sensitive = true. A CI smoke-test step needs the plain-text string in a shell variable, without surrounding quotes, while the normal apply log must keep hiding it. From the CLI of the same working directory, which approach returns the value?
Q2 · Terraform Pro objective 2, secrets and state
An auditor finds the database password in plain text inside the state object in S3, even though the variable and the output are both marked sensitive. The team's goal is to omit the value from state and plan files entirely, not merely to hide or encrypt it, and they run Terraform 1.11 or later. Which change meets the goal?
Q3 · Terraform Pro objective 6, HCP Terraform dynamic credentials
An HCP Terraform workspace runs against AWS using a static access key stored as a sensitive workspace variable. Security wants short-lived credentials generated for each run and no long-lived AWS key stored anywhere. Which configuration meets this requirement?
Q4 · DOP-C02 task 6.1, identity and access management at scale, SCPs
A new OU in AWS Organizations has an SCP that allows ec2:* and s3:*, and the default full-access SCP was removed from that OU. A role in a member account of the OU has no identity-based policies attached, and the buckets in the account have no bucket policies. What happens when the role calls s3:ListBucket?
Q5 · DOP-C02 task 6.2, security controls and data protection, KMS rotation
A compliance rule requires the cryptographic material of a symmetric customer managed KMS key (origin AWS_KMS) to be rotated. The key encrypts S3 objects and EBS volumes. Applications must keep using the same key ID and ARN, and existing data must not be re-encrypted. What should the team do?
Q6 · DOP-C02 task 6.3, security monitoring and auditing, CloudTrail
Auditors ask the team to prove, with evidence, that the CloudTrail log files delivered to S3 were not modified or deleted after delivery. The trail already delivers to a dedicated bucket. Which approach provides that proof?
Q7 · CKA cluster architecture, RBAC
A ClusterRole named secret-reader already exists. Developer dave must be able to read Secrets only in the development namespace, and the team wants to reuse that one ClusterRole rather than copy its rules into a new Role. Which approach meets this?
Q8 · CKA servicing and networking, NetworkPolicy
Namespace db has a NetworkPolicy that selects the database Pods. Ingress must be allowed only from Pods labelled role=client that are running in namespaces labelled user=alice. Which shape of the ingress.from rule does this?
Q9 · CKS cluster hardening, ServiceAccount tokens
A Deployment's Pods never call the Kubernetes API, but every Pod mounts a ServiceAccount token that an attacker with shell access could use. The ServiceAccount is shared with other workloads that do need the token, so it must not be changed in a way that affects them. What is the correct fix?
Q10 · CKS minimize microservice vulnerabilities, Pod Security Admission
Namespace prod currently has no Pod Security Admission labels. Policy says Pods that violate the baseline standard must be rejected, while Pods that violate restricted must still be admitted but show a warning to the user who creates them. Which labels implement this?
Q11 · CKS supply chain security, image digests
CI scans registry.example.com/edge/api:1.4 and the build passes, but the registry owner could later push a different image to the same tag. The Pod spec must run exactly the scanned content every time a container starts, on any node. What should the team do?
Q12 · CKS monitoring, logging and runtime security, audit policy
The cluster's audit policy must record who created, updated or read Secrets and when, but must not write Secret contents (request or response bodies) into the audit log. Rules are evaluated in order and the first matching rule sets the audit level. Which rule meets this?