Datasets:
Commit ·
1d72a45
1
Parent(s): c4b0624
Add generated/complex/gpt-4o/
Browse files- generated/complex/gpt-4o/complex-aws-tf-001/main.tf +172 -0
- generated/complex/gpt-4o/complex-aws-tf-002/main.tf +338 -0
- generated/complex/gpt-4o/complex-aws-tf-003/main.tf +255 -0
- generated/complex/gpt-4o/complex-aws-tf-004/main.yaml +266 -0
- generated/complex/gpt-4o/complex-aws-tf-005/main.yaml +425 -0
- generated/complex/gpt-4o/complex-aws-tf-006/main.tf +269 -0
- generated/complex/gpt-4o/complex-aws-tf-007/main.tf +189 -0
- generated/complex/gpt-4o/complex-aws-tf-008/main.tf +200 -0
- generated/complex/gpt-4o/complex-aws-tf-009/main.yaml +279 -0
- generated/complex/gpt-4o/complex-aws-tf-010/main.tf +234 -0
- generated/complex/gpt-4o/complex-azure-tf-001/main.tf +221 -0
- generated/complex/gpt-4o/complex-azure-tf-002/main.tf +185 -0
- generated/complex/gpt-4o/complex-azure-tf-003/main.json +409 -0
- generated/complex/gpt-4o/complex-azure-tf-004/main.tf +299 -0
- generated/complex/gpt-4o/complex-azure-tf-005/main.json +174 -0
- generated/complex/gpt-4o/complex-azure-tf-006/main.tf +191 -0
- generated/complex/gpt-4o/complex-azure-tf-007/main.tf +255 -0
- generated/complex/gpt-4o/complex-azure-tf-008/main.tf +154 -0
- generated/complex/gpt-4o/complex-azure-tf-009/main.json +299 -0
- generated/complex/gpt-4o/complex-azure-tf-010/main.tf +223 -0
- generated/complex/gpt-4o/complex-gcp-tf-001/main.tf +220 -0
- generated/complex/gpt-4o/complex-gcp-tf-002/main.tf +1952 -0
- generated/complex/gpt-4o/complex-gcp-tf-003/main.tf +176 -0
- generated/complex/gpt-4o/complex-gcp-tf-004/main.tf +221 -0
- generated/complex/gpt-4o/complex-gcp-tf-005/main.tf +176 -0
- generated/complex/gpt-4o/complex-gcp-tf-006/main.tf +190 -0
- generated/complex/gpt-4o/complex-gcp-tf-007/main.tf +157 -0
- generated/complex/gpt-4o/complex-gcp-tf-008/main.tf +176 -0
- generated/complex/gpt-4o/complex-gcp-tf-009/main.tf +144 -0
- generated/complex/gpt-4o/complex-gcp-tf-010/main.tf +165 -0
- generated/complex/gpt-4o/complex-k8s-tf-001/main.tf +243 -0
- generated/complex/gpt-4o/complex-k8s-tf-002/main.yaml +241 -0
- generated/complex/gpt-4o/complex-k8s-tf-003/main.yaml +128 -0
- generated/complex/gpt-4o/complex-k8s-tf-004/main.tf +398 -0
- generated/complex/gpt-4o/complex-k8s-tf-005/main.yaml +129 -0
- generated/complex/gpt-4o/complex-k8s-tf-006/main.tf +264 -0
- generated/complex/gpt-4o/complex-k8s-tf-007/main.yaml +264 -0
- generated/complex/gpt-4o/complex-k8s-tf-008/main.tf +139 -0
- generated/complex/gpt-4o/complex-k8s-tf-009/main.yaml +327 -0
- generated/complex/gpt-4o/complex-k8s-tf-010/main.tf +225 -0
generated/complex/gpt-4o/complex-aws-tf-001/main.tf
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "aws" {
|
| 2 |
+
alias = "us_east_1"
|
| 3 |
+
region = "us-east-1"
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
provider "aws" {
|
| 7 |
+
alias = "eu_west_1"
|
| 8 |
+
region = "eu-west-1"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
provider "aws" {
|
| 12 |
+
alias = "ap_southeast_1"
|
| 13 |
+
region = "ap-southeast-1"
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
provider "aws" {
|
| 17 |
+
alias = "security_account"
|
| 18 |
+
region = "us-east-1"
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
resource "aws_s3_bucket" "flow_logs" {
|
| 22 |
+
provider = aws.security_account
|
| 23 |
+
bucket = "centralized-security-flow-logs"
|
| 24 |
+
|
| 25 |
+
lifecycle_rule {
|
| 26 |
+
enabled = true
|
| 27 |
+
|
| 28 |
+
expiration {
|
| 29 |
+
days = 90
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
server_side_encryption_configuration {
|
| 34 |
+
rule {
|
| 35 |
+
apply_server_side_encryption_by_default {
|
| 36 |
+
sse_algorithm = "aws:kms"
|
| 37 |
+
kms_master_key_id = aws_kms_key.flow_logs.arn
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
resource "aws_kms_key" "flow_logs" {
|
| 44 |
+
provider = aws.security_account
|
| 45 |
+
description = "KMS CMK for encrypting VPC Flow Logs"
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
resource "aws_ec2_transit_gateway" "main" {
|
| 49 |
+
provider = aws.us_east_1
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
resource "aws_ec2_transit_gateway_route_table" "main" {
|
| 53 |
+
provider = aws.us_east_1
|
| 54 |
+
transit_gateway_id = aws_ec2_transit_gateway.main.id
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
resource "aws_ec2_transit_gateway_route" "blackhole" {
|
| 58 |
+
provider = aws.us_east_1
|
| 59 |
+
transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.main.id
|
| 60 |
+
destination_cidr_block = "10.0.0.0/8"
|
| 61 |
+
blackhole = true
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
resource "aws_vpc" "spoke" {
|
| 65 |
+
provider = aws.us_east_1
|
| 66 |
+
cidr_block = "10.1.0.0/16"
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
resource "aws_subnet" "private" {
|
| 70 |
+
provider = aws.us_east_1
|
| 71 |
+
vpc_id = aws_vpc.spoke.id
|
| 72 |
+
cidr_block = "10.1.1.0/24"
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
resource "aws_security_group" "allowlist" {
|
| 76 |
+
provider = aws.us_east_1
|
| 77 |
+
vpc_id = aws_vpc.spoke.id
|
| 78 |
+
|
| 79 |
+
ingress {
|
| 80 |
+
from_port = 0
|
| 81 |
+
to_port = 65535
|
| 82 |
+
protocol = "tcp"
|
| 83 |
+
cidr_blocks = ["203.0.113.0/24"] # Example allowlist
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
egress {
|
| 87 |
+
from_port = 0
|
| 88 |
+
to_port = 65535
|
| 89 |
+
protocol = "tcp"
|
| 90 |
+
cidr_blocks = ["0.0.0.0/0"]
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
resource "aws_network_acl" "strict" {
|
| 95 |
+
provider = aws.us_east_1
|
| 96 |
+
vpc_id = aws_vpc.spoke.id
|
| 97 |
+
|
| 98 |
+
egress {
|
| 99 |
+
rule_no = 100
|
| 100 |
+
protocol = "-1"
|
| 101 |
+
action = "allow"
|
| 102 |
+
cidr_block = "203.0.113.0/24"
|
| 103 |
+
from_port = 0
|
| 104 |
+
to_port = 0
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
ingress {
|
| 108 |
+
rule_no = 100
|
| 109 |
+
protocol = "-1"
|
| 110 |
+
action = "allow"
|
| 111 |
+
cidr_block = "203.0.113.0/24"
|
| 112 |
+
from_port = 0
|
| 113 |
+
to_port = 0
|
| 114 |
+
}
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
resource "aws_vpc_flow_log" "spoke" {
|
| 118 |
+
provider = aws.us_east_1
|
| 119 |
+
vpc_id = aws_vpc.spoke.id
|
| 120 |
+
log_destination = aws_s3_bucket.flow_logs.arn
|
| 121 |
+
log_destination_type = "s3"
|
| 122 |
+
traffic_type = "ALL"
|
| 123 |
+
log_format = "${aws_kms_key.flow_logs.arn}"
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
resource "aws_rds_cluster" "aurora" {
|
| 127 |
+
provider = aws.us_east_1
|
| 128 |
+
cluster_identifier = "aurora-cluster"
|
| 129 |
+
engine = "aurora-mysql"
|
| 130 |
+
master_username = "admin"
|
| 131 |
+
master_password = "password"
|
| 132 |
+
vpc_security_group_ids = [aws_security_group.allowlist.id]
|
| 133 |
+
db_subnet_group_name = aws_db_subnet_group.aurora.name
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
resource "aws_db_subnet_group" "aurora" {
|
| 137 |
+
provider = aws.us_east_1
|
| 138 |
+
name = "aurora-subnet-group"
|
| 139 |
+
subnet_ids = [aws_subnet.private.id]
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
resource "aws_nat_gateway" "egress" {
|
| 143 |
+
provider = aws.us_east_1
|
| 144 |
+
allocation_id = aws_eip.nat.id
|
| 145 |
+
subnet_id = aws_subnet.private.id
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
resource "aws_eip" "nat" {
|
| 149 |
+
provider = aws.us_east_1
|
| 150 |
+
vpc = true
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
resource "aws_networkfirewall_firewall" "main" {
|
| 154 |
+
provider = aws.us_east_1
|
| 155 |
+
firewall_name = "centralized-firewall"
|
| 156 |
+
vpc_id = aws_vpc.spoke.id
|
| 157 |
+
subnet_mappings {
|
| 158 |
+
subnet_id = aws_subnet.private.id
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
resource "aws_networkfirewall_rule_group" "suricata" {
|
| 163 |
+
provider = aws.us_east_1
|
| 164 |
+
capacity = 1000
|
| 165 |
+
rule_group_name = "suricata-compatible-rules"
|
| 166 |
+
type = "STATEFUL"
|
| 167 |
+
rule_group {
|
| 168 |
+
rules_source {
|
| 169 |
+
rules_string = "alert tcp any any -> any any (msg:\"Example rule\"; sid:1;)"
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
}
|
generated/complex/gpt-4o/complex-aws-tf-002/main.tf
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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luster_role.arn
|
| 8 |
+
|
| 9 |
+
vpc_config {
|
| 10 |
+
subnet_ids = aws_subnet.eks_subnets[*].id
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
depends_on = [aws_iam_role_policy_attachment.eks_cluster_policy]
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
resource "aws_iam_role" "eks_cluster_role" {
|
| 17 |
+
name = "eks-cluster-role"
|
| 18 |
+
|
| 19 |
+
assume_role_policy = data.aws_iam_policy_document.eks_assume_role_policy.json
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
data "aws_iam_policy_document" "eks_assume_role_policy" {
|
| 23 |
+
statement {
|
| 24 |
+
actions = ["sts:AssumeRole"]
|
| 25 |
+
|
| 26 |
+
principals {
|
| 27 |
+
type = "Service"
|
| 28 |
+
identifiers = ["eks.amazonaws.com"]
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
resource "aws_iam_role_policy_attachment" "eks_cluster_policy" {
|
| 34 |
+
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
|
| 35 |
+
role = aws_iam_role.eks_cluster_role.name
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
resource "aws_eks_node_group" "spot_nodes" {
|
| 39 |
+
cluster_name = aws_eks_cluster.example.name
|
| 40 |
+
node_group_name = "spot-nodes"
|
| 41 |
+
node_role_arn = aws_iam_role.eks_node_role.arn
|
| 42 |
+
subnets = aws_subnet.eks_subnets[*].id
|
| 43 |
+
|
| 44 |
+
scaling_config {
|
| 45 |
+
desired_size = 2
|
| 46 |
+
max_size = 5
|
| 47 |
+
min_size = 1
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
capacity_type = "SPOT"
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
resource "aws_eks_node_group" "on_demand_nodes" {
|
| 54 |
+
cluster_name = aws_eks_cluster.example.name
|
| 55 |
+
node_group_name = "on-demand-nodes"
|
| 56 |
+
node_role_arn = aws_iam_role.eks_node_role.arn
|
| 57 |
+
subnets = aws_subnet.eks_subnets[*].id
|
| 58 |
+
|
| 59 |
+
scaling_config {
|
| 60 |
+
desired_size = 2
|
| 61 |
+
max_size = 5
|
| 62 |
+
min_size = 1
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
capacity_type = "ON_DEMAND"
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
resource "aws_iam_role" "eks_node_role" {
|
| 69 |
+
name = "eks-node-role"
|
| 70 |
+
|
| 71 |
+
assume_role_policy = data.aws_iam_policy_document.eks_node_assume_role_policy.json
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
data "aws_iam_policy_document" "eks_node_assume_role_policy" {
|
| 75 |
+
statement {
|
| 76 |
+
actions = ["sts:AssumeRole"]
|
| 77 |
+
|
| 78 |
+
principals {
|
| 79 |
+
type = "Service"
|
| 80 |
+
identifiers = ["ec2.amazonaws.com"]
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
resource "aws_iam_role_policy_attachment" "eks_worker_node_policy" {
|
| 86 |
+
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy"
|
| 87 |
+
role = aws_iam_role.eks_node_role.name
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
resource "aws_iam_role_policy_attachment" "eks_cni_policy" {
|
| 91 |
+
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSCNIPolicy"
|
| 92 |
+
role = aws_iam_role.eks_node_role.name
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
resource "aws_iam_role_policy_attachment" "ec2_container_registry_read_only" {
|
| 96 |
+
policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
|
| 97 |
+
role = aws_iam_role.eks_node_role.name
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
resource "aws_iam_role" "external_dns_role" {
|
| 101 |
+
name = "external-dns-role"
|
| 102 |
+
|
| 103 |
+
assume_role_policy = data.aws_iam_policy_document.external_dns_assume_role_policy.json
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
data "aws_iam_policy_document" "external_dns_assume_role_policy" {
|
| 107 |
+
statement {
|
| 108 |
+
actions = ["sts:AssumeRole"]
|
| 109 |
+
|
| 110 |
+
principals {
|
| 111 |
+
type = "Service"
|
| 112 |
+
identifiers = ["eks.amazonaws.com"]
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
resource "aws_iam_policy" "external_dns_policy" {
|
| 118 |
+
name = "ExternalDNSPolicy"
|
| 119 |
+
|
| 120 |
+
policy = data.aws_iam_policy_document.external_dns_policy.json
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
data "aws_iam_policy_document" "external_dns_policy" {
|
| 124 |
+
statement {
|
| 125 |
+
actions = [
|
| 126 |
+
"route53:ChangeResourceRecordSets",
|
| 127 |
+
"route53:ListHostedZones",
|
| 128 |
+
"route53:ListResourceRecordSets"
|
| 129 |
+
]
|
| 130 |
+
|
| 131 |
+
resources = ["*"]
|
| 132 |
+
}
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
resource "aws_iam_role_policy_attachment" "external_dns_policy_attachment" {
|
| 136 |
+
policy_arn = aws_iam_policy.external_dns_policy.arn
|
| 137 |
+
role = aws_iam_role.external_dns_role.name
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
resource "aws_iam_role" "fluent_bit_role" {
|
| 141 |
+
name = "fluent-bit-role"
|
| 142 |
+
|
| 143 |
+
assume_role_policy = data.aws_iam_policy_document.fluent_bit_assume_role_policy.json
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
data "aws_iam_policy_document" "fluent_bit_assume_role_policy" {
|
| 147 |
+
statement {
|
| 148 |
+
actions = ["sts:AssumeRole"]
|
| 149 |
+
|
| 150 |
+
principals {
|
| 151 |
+
type = "Service"
|
| 152 |
+
identifiers = ["eks.amazonaws.com"]
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
resource "aws_iam_policy" "fluent_bit_policy" {
|
| 158 |
+
name = "FluentBitPolicy"
|
| 159 |
+
|
| 160 |
+
policy = data.aws_iam_policy_document.fluent_bit_policy.json
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
data "aws_iam_policy_document" "fluent_bit_policy" {
|
| 164 |
+
statement {
|
| 165 |
+
actions = [
|
| 166 |
+
"logs:PutLogEvents",
|
| 167 |
+
"logs:DescribeLogStreams",
|
| 168 |
+
"logs:DescribeLogGroups",
|
| 169 |
+
"logs:CreateLogStream",
|
| 170 |
+
"logs:CreateLogGroup"
|
| 171 |
+
]
|
| 172 |
+
|
| 173 |
+
resources = ["*"]
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
resource "aws_iam_role_policy_attachment" "fluent_bit_policy_attachment" {
|
| 178 |
+
policy_arn = aws_iam_policy.fluent_bit_policy.arn
|
| 179 |
+
role = aws_iam_role.fluent_bit_role.name
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
resource "kubernetes_namespace" "tenant_a" {
|
| 183 |
+
metadata {
|
| 184 |
+
name = "tenant-a"
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
resource "kubernetes_namespace" "tenant_b" {
|
| 189 |
+
metadata {
|
| 190 |
+
name = "tenant-b"
|
| 191 |
+
}
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
resource "kubernetes_resource_quota" "tenant_a_quota" {
|
| 195 |
+
metadata {
|
| 196 |
+
name = "tenant-a-quota"
|
| 197 |
+
namespace = kubernetes_namespace.tenant_a.metadata[0].name
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
spec {
|
| 201 |
+
hard = {
|
| 202 |
+
"requests.cpu" = "1",
|
| 203 |
+
"requests.memory" = "1Gi",
|
| 204 |
+
"limits.cpu" = "2",
|
| 205 |
+
"limits.memory" = "2Gi"
|
| 206 |
+
}
|
| 207 |
+
}
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
resource "kubernetes_limit_range" "tenant_a_limits" {
|
| 211 |
+
metadata {
|
| 212 |
+
name = "tenant-a-limits"
|
| 213 |
+
namespace = kubernetes_namespace.tenant_a.metadata[0].name
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
spec {
|
| 217 |
+
limit {
|
| 218 |
+
type = "Container"
|
| 219 |
+
default = { "cpu" = "500m", "memory" = "512Mi" }
|
| 220 |
+
default_request = { "cpu" = "250m", "memory" = "256Mi" }
|
| 221 |
+
}
|
| 222 |
+
}
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
resource "kubernetes_network_policy" "tenant_a_policy" {
|
| 226 |
+
metadata {
|
| 227 |
+
name = "tenant-a-policy"
|
| 228 |
+
namespace = kubernetes_namespace.tenant_a.metadata[0].name
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
spec {
|
| 232 |
+
pod_selector {}
|
| 233 |
+
|
| 234 |
+
ingress {
|
| 235 |
+
from {
|
| 236 |
+
pod_selector {}
|
| 237 |
+
}
|
| 238 |
+
}
|
| 239 |
+
}
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
resource "kubernetes_network_policy" "tenant_b_policy" {
|
| 243 |
+
metadata {
|
| 244 |
+
name = "tenant-b-policy"
|
| 245 |
+
namespace = kubernetes_namespace.tenant_b.metadata[0].name
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
spec {
|
| 249 |
+
pod_selector {}
|
| 250 |
+
|
| 251 |
+
ingress {
|
| 252 |
+
from {
|
| 253 |
+
pod_selector {}
|
| 254 |
+
}
|
| 255 |
+
}
|
| 256 |
+
}
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
resource "kubernetes_service_account" "external_dns" {
|
| 260 |
+
metadata {
|
| 261 |
+
name = "external-dns"
|
| 262 |
+
namespace = "kube-system"
|
| 263 |
+
annotations = {
|
| 264 |
+
"eks.amazonaws.com/role-arn" = aws_iam_role.external_dns_role.arn
|
| 265 |
+
}
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
resource "kubernetes_service_account" "fluent_bit" {
|
| 270 |
+
metadata {
|
| 271 |
+
name = "fluent-bit"
|
| 272 |
+
namespace = "kube-system"
|
| 273 |
+
annotations = {
|
| 274 |
+
"eks.amazonaws.com/role-arn" = aws_iam_role.fluent_bit_role.arn
|
| 275 |
+
}
|
| 276 |
+
}
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
resource "kubernetes_daemonset" "fluent_bit" {
|
| 280 |
+
metadata {
|
| 281 |
+
name = "fluent-bit"
|
| 282 |
+
namespace = "kube-system"
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
spec {
|
| 286 |
+
selector {
|
| 287 |
+
match_labels = {
|
| 288 |
+
"app" = "fluent-bit"
|
| 289 |
+
}
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
template {
|
| 293 |
+
metadata {
|
| 294 |
+
labels = {
|
| 295 |
+
"app" = "fluent-bit"
|
| 296 |
+
}
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
spec {
|
| 300 |
+
service_account_name = kubernetes_service_account.fluent_bit.metadata[0].name
|
| 301 |
+
|
| 302 |
+
container {
|
| 303 |
+
name = "fluent-bit"
|
| 304 |
+
image = "fluent/fluent-bit:latest"
|
| 305 |
+
|
| 306 |
+
resources {
|
| 307 |
+
limits {
|
| 308 |
+
cpu = "100m"
|
| 309 |
+
memory = "200Mi"
|
| 310 |
+
}
|
| 311 |
+
requests {
|
| 312 |
+
cpu = "50m"
|
| 313 |
+
memory = "100Mi"
|
| 314 |
+
}
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
volume_mount {
|
| 318 |
+
name = "varlog"
|
| 319 |
+
mount_path = "/var/log"
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
env {
|
| 323 |
+
name = "AWS_REG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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "aws" {
|
| 2 |
+
region = "us-east-1"
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
resource "aws_kms_key" "dynamodb" {
|
| 6 |
+
description = "KMS key for DynamoDB encryption"
|
| 7 |
+
deletion_window_in_days = 30
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
resource "aws_dynamodb_table" "data_table" {
|
| 11 |
+
name = "data-table"
|
| 12 |
+
billing_mode = "PAY_PER_REQUEST"
|
| 13 |
+
hash_key = "id"
|
| 14 |
+
attribute {
|
| 15 |
+
name = "id"
|
| 16 |
+
type = "S"
|
| 17 |
+
}
|
| 18 |
+
server_side_encryption {
|
| 19 |
+
enabled = true
|
| 20 |
+
kms_key_arn = aws_kms_key.dynamodb.arn
|
| 21 |
+
}
|
| 22 |
+
point_in_time_recovery {
|
| 23 |
+
enabled = true
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
resource "aws_s3_bucket" "data_bucket" {
|
| 28 |
+
bucket = "data-bucket"
|
| 29 |
+
versioning {
|
| 30 |
+
enabled = true
|
| 31 |
+
}
|
| 32 |
+
server_side_encryption_configuration {
|
| 33 |
+
rule {
|
| 34 |
+
apply_server_side_encryption_by_default {
|
| 35 |
+
sse_algorithm = "aws:kms"
|
| 36 |
+
kms_master_key_id = aws_kms_key.dynamodb.arn
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
object_lock_configuration {
|
| 41 |
+
object_lock_enabled = "Enabled"
|
| 42 |
+
rule {
|
| 43 |
+
default_retention {
|
| 44 |
+
mode = "COMPLIANCE"
|
| 45 |
+
days = 365
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
logging {
|
| 50 |
+
target_bucket = aws_s3_bucket.logging_bucket.id
|
| 51 |
+
target_prefix = "data-bucket-logs/"
|
| 52 |
+
}
|
| 53 |
+
policy = <<POLICY
|
| 54 |
+
{
|
| 55 |
+
"Version": "2012-10-17",
|
| 56 |
+
"Statement": [
|
| 57 |
+
{
|
| 58 |
+
"Sid": "DenyUnencryptedObjectUploads",
|
| 59 |
+
"Effect": "Deny",
|
| 60 |
+
"Principal": "*",
|
| 61 |
+
"Action": "s3:PutObject",
|
| 62 |
+
"Resource": "arn:aws:s3:::data-bucket/*",
|
| 63 |
+
"Condition": {
|
| 64 |
+
"StringNotEquals": {
|
| 65 |
+
"s3:x-amz-server-side-encryption": "aws:kms"
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"Sid": "AllowSSLRequestsOnly",
|
| 71 |
+
"Effect": "Deny",
|
| 72 |
+
"Principal": "*",
|
| 73 |
+
"Action": "s3:*",
|
| 74 |
+
"Resource": "arn:aws:s3:::data-bucket/*",
|
| 75 |
+
"Condition": {
|
| 76 |
+
"Bool": {
|
| 77 |
+
"aws:SecureTransport": "false"
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
]
|
| 82 |
+
}
|
| 83 |
+
POLICY
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
resource "aws_s3_bucket" "logging_bucket" {
|
| 87 |
+
bucket = "logging-bucket"
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
resource "aws_sqs_queue" "fifo_queue" {
|
| 91 |
+
name = "fifo-queue.fifo"
|
| 92 |
+
fifo_queue = true
|
| 93 |
+
content_based_deduplication = true
|
| 94 |
+
kms_master_key_id = aws_kms_key.dynamodb.arn
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
resource "aws_sqs_queue" "dead_letter_queue" {
|
| 98 |
+
name = "dead-letter-queue.fifo"
|
| 99 |
+
fifo_queue = true
|
| 100 |
+
kms_master_key_id = aws_kms_key.dynamodb.arn
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
resource "aws_lambda_function" "data_processor" {
|
| 104 |
+
filename = "function.zip"
|
| 105 |
+
function_name = "data_processor"
|
| 106 |
+
role = aws_iam_role.lambda_exec.arn
|
| 107 |
+
handler = "index.handler"
|
| 108 |
+
runtime = "nodejs14.x"
|
| 109 |
+
vpc_config {
|
| 110 |
+
subnet_ids = ["subnet-abc123", "subnet-def456"]
|
| 111 |
+
security_group_ids = ["sg-123456"]
|
| 112 |
+
}
|
| 113 |
+
provisioned_concurrent_executions = 5
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
resource "aws_api_gateway_rest_api" "api" {
|
| 117 |
+
name = "data-api"
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
resource "aws_api_gateway_stage" "stage" {
|
| 121 |
+
stage_name = "prod"
|
| 122 |
+
rest_api_id = aws_api_gateway_rest_api.api.id
|
| 123 |
+
deployment_id = aws_api_gateway_deployment.deployment.id
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
resource "aws_api_gateway_deployment" "deployment" {
|
| 127 |
+
rest_api_id = aws_api_gateway_rest_api.api.id
|
| 128 |
+
triggers = {
|
| 129 |
+
redeployment = sha1(file("swagger.yaml"))
|
| 130 |
+
}
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
resource "aws_wafv2_web_acl" "web_acl" {
|
| 134 |
+
name = "web-acl"
|
| 135 |
+
scope = "REGIONAL"
|
| 136 |
+
description = "WAF for API Gateway"
|
| 137 |
+
default_action {
|
| 138 |
+
allow {}
|
| 139 |
+
}
|
| 140 |
+
rule {
|
| 141 |
+
name = "RateLimit"
|
| 142 |
+
priority = 1
|
| 143 |
+
statement {
|
| 144 |
+
rate_based_statement {
|
| 145 |
+
limit = 1000
|
| 146 |
+
aggregate_key_type = "IP"
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
action {
|
| 150 |
+
block {}
|
| 151 |
+
}
|
| 152 |
+
visibility_config {
|
| 153 |
+
sampled_requests_enabled = true
|
| 154 |
+
cloudwatch_metrics_enabled = true
|
| 155 |
+
metric_name = "RateLimit"
|
| 156 |
+
}
|
| 157 |
+
}
|
| 158 |
+
rule {
|
| 159 |
+
name = "GeoBlock"
|
| 160 |
+
priority = 2
|
| 161 |
+
statement {
|
| 162 |
+
geo_match_statement {
|
| 163 |
+
country_codes = ["US", "CA"]
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
action {
|
| 167 |
+
block {}
|
| 168 |
+
}
|
| 169 |
+
visibility_config {
|
| 170 |
+
sampled_requests_enabled = true
|
| 171 |
+
cloudwatch_metrics_enabled = true
|
| 172 |
+
metric_name = "GeoBlock"
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
resource "aws_cloudtrail" "organization_trail" {
|
| 178 |
+
name = "organization-trail"
|
| 179 |
+
is_organization_trail = true
|
| 180 |
+
include_global_service_events = true
|
| 181 |
+
is_multi_region_trail = true
|
| 182 |
+
enable_log_file_validation = true
|
| 183 |
+
s3_bucket_name = aws_s3_bucket.logging_bucket.id
|
| 184 |
+
event_selector {
|
| 185 |
+
read_write_type = "All"
|
| 186 |
+
include_management_events = true
|
| 187 |
+
data_resource {
|
| 188 |
+
type = "AWS::S3::Object"
|
| 189 |
+
values = ["arn:aws:s3:::data-bucket/"]
|
| 190 |
+
}
|
| 191 |
+
data_resource {
|
| 192 |
+
type = "AWS::Lambda::Function"
|
| 193 |
+
values = ["arn:aws:lambda:us-east-1:123456789012:function:data_processor"]
|
| 194 |
+
}
|
| 195 |
+
}
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
resource "aws_sfn_state_machine" "state_machine" {
|
| 199 |
+
name = "data-processing-state-machine"
|
| 200 |
+
role_arn = aws_iam_role.sfn_role.arn
|
| 201 |
+
definition = <<DEFINITION
|
| 202 |
+
{
|
| 203 |
+
"Comment": "A simple AWS Step Functions state machine",
|
| 204 |
+
"StartAt": "LambdaInvoke",
|
| 205 |
+
"States": {
|
| 206 |
+
"LambdaInvoke": {
|
| 207 |
+
"Type": "Task",
|
| 208 |
+
"Resource": "${aws_lambda_function.data_processor.arn}",
|
| 209 |
+
"End": true
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
DEFINITION
|
| 214 |
+
tracing_configuration {
|
| 215 |
+
enabled = true
|
| 216 |
+
}
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
resource "aws_iam_role" "lambda_exec" {
|
| 220 |
+
name = "lambda_exec_role"
|
| 221 |
+
assume_role_policy = <<POLICY
|
| 222 |
+
{
|
| 223 |
+
"Version": "2012-10-17",
|
| 224 |
+
"Statement": [
|
| 225 |
+
{
|
| 226 |
+
"Action": "sts:AssumeRole",
|
| 227 |
+
"Principal": {
|
| 228 |
+
"Service": "lambda.amazonaws.com"
|
| 229 |
+
},
|
| 230 |
+
"Effect": "Allow",
|
| 231 |
+
"Sid": ""
|
| 232 |
+
}
|
| 233 |
+
]
|
| 234 |
+
}
|
| 235 |
+
POLICY
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
resource "aws_iam_role" "sfn_role" {
|
| 239 |
+
name = "sfn_role"
|
| 240 |
+
assume_role_policy = <<POLICY
|
| 241 |
+
{
|
| 242 |
+
"Version": "2012-10-17",
|
| 243 |
+
"Statement": [
|
| 244 |
+
{
|
| 245 |
+
"Action": "sts:AssumeRole",
|
| 246 |
+
"Principal": {
|
| 247 |
+
"Service": "states.amazonaws.com"
|
| 248 |
+
},
|
| 249 |
+
"Effect": "Allow",
|
| 250 |
+
"Sid": ""
|
| 251 |
+
}
|
| 252 |
+
]
|
| 253 |
+
}
|
| 254 |
+
POLICY
|
| 255 |
+
}
|
generated/complex/gpt-4o/complex-aws-tf-004/main.yaml
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
AWSTemplateFormatVersion: '2010-09-09'
|
| 2 |
+
Description: AWS CloudFormation StackSet for Security Baseline
|
| 3 |
+
|
| 4 |
+
Resources:
|
| 5 |
+
SecurityBaselineStackSet:
|
| 6 |
+
Type: AWS::CloudFormation::StackSet
|
| 7 |
+
Properties:
|
| 8 |
+
StackSetName: SecurityBaseline
|
| 9 |
+
PermissionModel: SERVICE_MANAGED
|
| 10 |
+
AutoDeployment:
|
| 11 |
+
Enabled: true
|
| 12 |
+
RetainStacksOnAccountRemoval: false
|
| 13 |
+
Capabilities:
|
| 14 |
+
- CAPABILITY_NAMED_IAM
|
| 15 |
+
Parameters:
|
| 16 |
+
- ParameterKey: SecurityOperationsEmail
|
| 17 |
+
ParameterValue: security-ops@example.com
|
| 18 |
+
TemplateBody: |
|
| 19 |
+
AWSTemplateFormatVersion: '2010-09-09'
|
| 20 |
+
Description: Security Baseline Template
|
| 21 |
+
|
| 22 |
+
Resources:
|
| 23 |
+
ConfigRecorder:
|
| 24 |
+
Type: AWS::Config::ConfigurationRecorder
|
| 25 |
+
Properties:
|
| 26 |
+
Name: default
|
| 27 |
+
RoleARN: !Sub arn:aws:iam::${AWS::AccountId}:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig
|
| 28 |
+
RecordingGroup:
|
| 29 |
+
AllSupported: true
|
| 30 |
+
IncludeGlobalResourceTypes: true
|
| 31 |
+
|
| 32 |
+
ConfigDeliveryChannel:
|
| 33 |
+
Type: AWS::Config::DeliveryChannel
|
| 34 |
+
Properties:
|
| 35 |
+
S3BucketName: !Sub aws-config-bucket-${AWS::AccountId}
|
| 36 |
+
ConfigSnapshotDeliveryProperties:
|
| 37 |
+
DeliveryFrequency: One_Hour
|
| 38 |
+
|
| 39 |
+
ConfigRuleEncryptedVolumes:
|
| 40 |
+
Type: AWS::Config::ConfigRule
|
| 41 |
+
Properties:
|
| 42 |
+
ConfigRuleName: encrypted-volumes
|
| 43 |
+
Source:
|
| 44 |
+
Owner: AWS
|
| 45 |
+
SourceIdentifier: ENCRYPTED_VOLUMES
|
| 46 |
+
|
| 47 |
+
ConfigRuleRootMfa:
|
| 48 |
+
Type: AWS::Config::ConfigRule
|
| 49 |
+
Properties:
|
| 50 |
+
ConfigRuleName: root-account-mfa-enabled
|
| 51 |
+
Source:
|
| 52 |
+
Owner: AWS
|
| 53 |
+
SourceIdentifier: ROOT_ACCOUNT_MFA_ENABLED
|
| 54 |
+
|
| 55 |
+
ConfigRuleVpcFlowLogs:
|
| 56 |
+
Type: AWS::Config::ConfigRule
|
| 57 |
+
Properties:
|
| 58 |
+
ConfigRuleName: vpc-flow-logs-enabled
|
| 59 |
+
Source:
|
| 60 |
+
Owner: AWS
|
| 61 |
+
SourceIdentifier: VPC_FLOW_LOGS_ENABLED
|
| 62 |
+
|
| 63 |
+
GuardDutyDetector:
|
| 64 |
+
Type: AWS::GuardDuty::Detector
|
| 65 |
+
Properties:
|
| 66 |
+
Enable: true
|
| 67 |
+
FindingPublishingFrequency: FIFTEEN_MINUTES
|
| 68 |
+
|
| 69 |
+
GuardDutyS3Protection:
|
| 70 |
+
Type: AWS::GuardDuty::Detector
|
| 71 |
+
Properties:
|
| 72 |
+
DataSources:
|
| 73 |
+
S3Logs:
|
| 74 |
+
Enable: true
|
| 75 |
+
|
| 76 |
+
GuardDutyEksAuditLogs:
|
| 77 |
+
Type: AWS::GuardDuty::Detector
|
| 78 |
+
Properties:
|
| 79 |
+
DataSources:
|
| 80 |
+
Kubernetes:
|
| 81 |
+
AuditLogs:
|
| 82 |
+
Enable: true
|
| 83 |
+
|
| 84 |
+
SecurityHub:
|
| 85 |
+
Type: AWS::SecurityHub::Hub
|
| 86 |
+
Properties: {}
|
| 87 |
+
|
| 88 |
+
SecurityHubCIS:
|
| 89 |
+
Type: AWS::SecurityHub::StandardsSubscription
|
| 90 |
+
Properties:
|
| 91 |
+
StandardsArn: !Sub arn:aws:securityhub:${AWS::Region}::standards/cis-aws-foundations-benchmark/v/1.2.0
|
| 92 |
+
|
| 93 |
+
SecurityHubPCI:
|
| 94 |
+
Type: AWS::SecurityHub::StandardsSubscription
|
| 95 |
+
Properties:
|
| 96 |
+
StandardsArn: !Sub arn:aws:securityhub:${AWS::Region}::standards/pci-dss/v/3.2.1
|
| 97 |
+
|
| 98 |
+
AccessAnalyzer:
|
| 99 |
+
Type: AWS::AccessAnalyzer::Analyzer
|
| 100 |
+
Properties:
|
| 101 |
+
AnalyzerName: OrganizationAccessAnalyzer
|
| 102 |
+
Type: ORGANIZATION
|
| 103 |
+
|
| 104 |
+
CloudTrail:
|
| 105 |
+
Type: AWS::CloudTrail::Trail
|
| 106 |
+
Properties:
|
| 107 |
+
IsOrganizationTrail: true
|
| 108 |
+
S3BucketName: !Sub aws-cloudtrail-bucket-${AWS::AccountId}
|
| 109 |
+
IncludeGlobalServiceEvents: true
|
| 110 |
+
IsMultiRegionTrail: true
|
| 111 |
+
CloudWatchLogsLogGroupArn: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:CloudTrailLogs
|
| 112 |
+
CloudWatchLogsRoleArn: !Sub arn:aws:iam::${AWS::AccountId}:role/CloudTrail_CloudWatchLogs_Role
|
| 113 |
+
|
| 114 |
+
UnauthorizedApiCallsMetricFilter:
|
| 115 |
+
Type: AWS::Logs::MetricFilter
|
| 116 |
+
Properties:
|
| 117 |
+
LogGroupName: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:CloudTrailLogs
|
| 118 |
+
FilterPattern: '{ ($.errorCode = "*UnauthorizedOperation") || ($.errorCode = "AccessDenied*") }'
|
| 119 |
+
MetricTransformations:
|
| 120 |
+
- MetricValue: "1"
|
| 121 |
+
MetricNamespace: CloudTrailMetrics
|
| 122 |
+
MetricName: UnauthorizedApiCalls
|
| 123 |
+
|
| 124 |
+
ConsoleSigninWithoutMfaMetricFilter:
|
| 125 |
+
Type: AWS::Logs::MetricFilter
|
| 126 |
+
Properties:
|
| 127 |
+
LogGroupName: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:CloudTrailLogs
|
| 128 |
+
FilterPattern: '{ ($.eventName = "ConsoleLogin") && ($.additionalEventData.MFAUsed != "Yes") }'
|
| 129 |
+
MetricTransformations:
|
| 130 |
+
- MetricValue: "1"
|
| 131 |
+
MetricNamespace: CloudTrailMetrics
|
| 132 |
+
MetricName: ConsoleSigninWithoutMfa
|
| 133 |
+
|
| 134 |
+
RootAccountUsageMetricFilter:
|
| 135 |
+
Type: AWS::Logs::MetricFilter
|
| 136 |
+
Properties:
|
| 137 |
+
LogGroupName: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:CloudTrailLogs
|
| 138 |
+
FilterPattern: '{ $.userIdentity.type = "Root" && $.userIdentity.invokedBy NOT EXISTS && $.eventType != "AwsServiceEvent" }'
|
| 139 |
+
MetricTransformations:
|
| 140 |
+
- MetricValue: "1"
|
| 141 |
+
MetricNamespace: CloudTrailMetrics
|
| 142 |
+
MetricName: RootAccountUsage
|
| 143 |
+
|
| 144 |
+
SnsTopic:
|
| 145 |
+
Type: AWS::SNS::Topic
|
| 146 |
+
Properties:
|
| 147 |
+
Subscription:
|
| 148 |
+
- Endpoint: !Ref SecurityOperationsEmail
|
| 149 |
+
Protocol: email
|
| 150 |
+
|
| 151 |
+
UnauthorizedApiCallsAlarm:
|
| 152 |
+
Type: AWS::CloudWatch::Alarm
|
| 153 |
+
Properties:
|
| 154 |
+
AlarmName: UnauthorizedApiCalls
|
| 155 |
+
MetricName: UnauthorizedApiCalls
|
| 156 |
+
Namespace: CloudTrailMetrics
|
| 157 |
+
Statistic: Sum
|
| 158 |
+
Period: 300
|
| 159 |
+
EvaluationPeriods: 1
|
| 160 |
+
Threshold: 1
|
| 161 |
+
ComparisonOperator: GreaterThanOrEqualToThreshold
|
| 162 |
+
AlarmActions:
|
| 163 |
+
- !Ref SnsTopic
|
| 164 |
+
|
| 165 |
+
ConsoleSigninWithoutMfaAlarm:
|
| 166 |
+
Type: AWS::CloudWatch::Alarm
|
| 167 |
+
Properties:
|
| 168 |
+
AlarmName: ConsoleSigninWithoutMfa
|
| 169 |
+
MetricName: ConsoleSigninWithoutMfa
|
| 170 |
+
Namespace: CloudTrailMetrics
|
| 171 |
+
Statistic: Sum
|
| 172 |
+
Period: 300
|
| 173 |
+
EvaluationPeriods: 1
|
| 174 |
+
Threshold: 1
|
| 175 |
+
ComparisonOperator: GreaterThanOrEqualToThreshold
|
| 176 |
+
AlarmActions:
|
| 177 |
+
- !Ref SnsTopic
|
| 178 |
+
|
| 179 |
+
RootAccountUsageAlarm:
|
| 180 |
+
Type: AWS::CloudWatch::Alarm
|
| 181 |
+
Properties:
|
| 182 |
+
AlarmName: RootAccountUsage
|
| 183 |
+
MetricName: RootAccountUsage
|
| 184 |
+
Namespace: CloudTrailMetrics
|
| 185 |
+
Statistic: Sum
|
| 186 |
+
Period: 300
|
| 187 |
+
EvaluationPeriods: 1
|
| 188 |
+
Threshold: 1
|
| 189 |
+
ComparisonOperator: GreaterThanOrEqualToThreshold
|
| 190 |
+
AlarmActions:
|
| 191 |
+
- !Ref SnsTopic
|
| 192 |
+
|
| 193 |
+
LambdaEbsEncryption:
|
| 194 |
+
Type: AWS::Lambda::Function
|
| 195 |
+
Properties:
|
| 196 |
+
Handler: index.handler
|
| 197 |
+
Role: !GetAtt LambdaExecutionRole.Arn
|
| 198 |
+
Code:
|
| 199 |
+
ZipFile: |
|
| 200 |
+
import boto3
|
| 201 |
+
def handler(event, context):
|
| 202 |
+
ec2 = boto3.client('ec2')
|
| 203 |
+
ec2.modify_ebs_default_kms_key_id(KmsKeyId='alias/aws/ebs')
|
| 204 |
+
ec2.enable_ebs_encryption_by_default()
|
| 205 |
+
Runtime: python3.8
|
| 206 |
+
|
| 207 |
+
LambdaS3PublicAccessBlock:
|
| 208 |
+
Type: AWS::Lambda::Function
|
| 209 |
+
Properties:
|
| 210 |
+
Handler: index.handler
|
| 211 |
+
Role: !GetAtt LambdaExecutionRole.Arn
|
| 212 |
+
Code:
|
| 213 |
+
ZipFile: |
|
| 214 |
+
import boto3
|
| 215 |
+
def handler(event, context):
|
| 216 |
+
s3 = boto3.client('s3control')
|
| 217 |
+
account_id = boto3.client('sts').get_caller_identity().get('Account')
|
| 218 |
+
s3.put_public_access_block(
|
| 219 |
+
AccountId=account_id,
|
| 220 |
+
PublicAccessBlockConfiguration={
|
| 221 |
+
'BlockPublicAcls': True,
|
| 222 |
+
'IgnorePublicAcls': True,
|
| 223 |
+
'BlockPublicPolicy': True,
|
| 224 |
+
'RestrictPublicBuckets': True
|
| 225 |
+
}
|
| 226 |
+
)
|
| 227 |
+
Runtime: python3.8
|
| 228 |
+
|
| 229 |
+
LambdaExecutionRole:
|
| 230 |
+
Type: AWS::IAM::Role
|
| 231 |
+
Properties:
|
| 232 |
+
AssumeRolePolicyDocument:
|
| 233 |
+
Version: '2012-10-17'
|
| 234 |
+
Statement:
|
| 235 |
+
- Effect: Allow
|
| 236 |
+
Principal:
|
| 237 |
+
Service: lambda.amazonaws.com
|
| 238 |
+
Action: sts:AssumeRole
|
| 239 |
+
Policies:
|
| 240 |
+
- PolicyName: LambdaEbsEncryptionPolicy
|
| 241 |
+
PolicyDocument:
|
| 242 |
+
Version: '2012-10-17'
|
| 243 |
+
Statement:
|
| 244 |
+
- Effect: Allow
|
| 245 |
+
Action:
|
| 246 |
+
- ec2:ModifyEbsDefaultKmsKeyId
|
| 247 |
+
- ec2:EnableEbsEncryptionByDefault
|
| 248 |
+
Resource: '*'
|
| 249 |
+
- PolicyName: LambdaS3PublicAccessBlockPolicy
|
| 250 |
+
PolicyDocument:
|
| 251 |
+
Version: '2012-10-17'
|
| 252 |
+
Statement:
|
| 253 |
+
- Effect: Allow
|
| 254 |
+
Action:
|
| 255 |
+
- s3:PutAccountPublicAccessBlock
|
| 256 |
+
Resource: '*'
|
| 257 |
+
|
| 258 |
+
DeploymentTargets:
|
| 259 |
+
OrganizationalUnitIds:
|
| 260 |
+
- ou-1234
|
| 261 |
+
- ou-5678
|
| 262 |
+
- ou-91011
|
| 263 |
+
|
| 264 |
+
Regions:
|
| 265 |
+
- us-east-1
|
| 266 |
+
- us-west-2
|
generated/complex/gpt-4o/complex-aws-tf-005/main.yaml
ADDED
|
@@ -0,0 +1,425 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
AWSTemplateFormatVersion: '2010-09-09'
|
| 2 |
+
Resources:
|
| 3 |
+
ECRRepository:
|
| 4 |
+
Type: AWS::ECR::Repository
|
| 5 |
+
Properties:
|
| 6 |
+
RepositoryName: my-app-repo
|
| 7 |
+
ImageScanningConfiguration:
|
| 8 |
+
ScanOnPush: true
|
| 9 |
+
LifecyclePolicy:
|
| 10 |
+
LifecyclePolicyText: |
|
| 11 |
+
{
|
| 12 |
+
"rules": [
|
| 13 |
+
{
|
| 14 |
+
"rulePriority": 1,
|
| 15 |
+
"description": "Retain only last 10 images",
|
| 16 |
+
"selection": {
|
| 17 |
+
"tagStatus": "any",
|
| 18 |
+
"countType": "imageCountMoreThan",
|
| 19 |
+
"countNumber": 10
|
| 20 |
+
},
|
| 21 |
+
"action": {
|
| 22 |
+
"type": "expire"
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
]
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
ECSCluster:
|
| 29 |
+
Type: AWS::ECS::Cluster
|
| 30 |
+
Properties:
|
| 31 |
+
ClusterName: my-ecs-cluster
|
| 32 |
+
ClusterSettings:
|
| 33 |
+
- Name: containerInsights
|
| 34 |
+
Value: enabled
|
| 35 |
+
|
| 36 |
+
ALB:
|
| 37 |
+
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
|
| 38 |
+
Properties:
|
| 39 |
+
Name: my-alb
|
| 40 |
+
Scheme: internet-facing
|
| 41 |
+
Subnets:
|
| 42 |
+
- subnet-12345678
|
| 43 |
+
- subnet-87654321
|
| 44 |
+
SecurityGroups:
|
| 45 |
+
- !Ref ALBSecurityGroup
|
| 46 |
+
|
| 47 |
+
ALBSecurityGroup:
|
| 48 |
+
Type: AWS::EC2::SecurityGroup
|
| 49 |
+
Properties:
|
| 50 |
+
GroupDescription: Allow HTTP and HTTPS traffic
|
| 51 |
+
VpcId: vpc-12345678
|
| 52 |
+
SecurityGroupIngress:
|
| 53 |
+
- IpProtocol: tcp
|
| 54 |
+
FromPort: 80
|
| 55 |
+
ToPort: 80
|
| 56 |
+
CidrIp: 0.0.0.0/0
|
| 57 |
+
- IpProtocol: tcp
|
| 58 |
+
FromPort: 443
|
| 59 |
+
ToPort: 443
|
| 60 |
+
CidrIp: 0.0.0.0/0
|
| 61 |
+
|
| 62 |
+
ECSServiceSecurityGroup:
|
| 63 |
+
Type: AWS::EC2::SecurityGroup
|
| 64 |
+
Properties:
|
| 65 |
+
GroupDescription: Allow traffic from ALB only
|
| 66 |
+
VpcId: vpc-12345678
|
| 67 |
+
SecurityGroupIngress:
|
| 68 |
+
- IpProtocol: tcp
|
| 69 |
+
FromPort: 80
|
| 70 |
+
ToPort: 80
|
| 71 |
+
SourceSecurityGroupId: !Ref ALBSecurityGroup
|
| 72 |
+
|
| 73 |
+
TargetGroupBlue:
|
| 74 |
+
Type: AWS::ElasticLoadBalancingV2::TargetGroup
|
| 75 |
+
Properties:
|
| 76 |
+
Name: my-blue-target-group
|
| 77 |
+
Port: 80
|
| 78 |
+
Protocol: HTTP
|
| 79 |
+
VpcId: vpc-12345678
|
| 80 |
+
TargetType: ip
|
| 81 |
+
|
| 82 |
+
TargetGroupGreen:
|
| 83 |
+
Type: AWS::ElasticLoadBalancingV2::TargetGroup
|
| 84 |
+
Properties:
|
| 85 |
+
Name: my-green-target-group
|
| 86 |
+
Port: 80
|
| 87 |
+
Protocol: HTTP
|
| 88 |
+
VpcId: vpc-12345678
|
| 89 |
+
TargetType: ip
|
| 90 |
+
|
| 91 |
+
Listener:
|
| 92 |
+
Type: AWS::ElasticLoadBalancingV2::Listener
|
| 93 |
+
Properties:
|
| 94 |
+
LoadBalancerArn: !Ref ALB
|
| 95 |
+
Port: 80
|
| 96 |
+
Protocol: HTTP
|
| 97 |
+
DefaultActions:
|
| 98 |
+
- Type: forward
|
| 99 |
+
TargetGroupArn: !Ref TargetGroupBlue
|
| 100 |
+
|
| 101 |
+
ECSServiceBlue:
|
| 102 |
+
Type: AWS::ECS::Service
|
| 103 |
+
Properties:
|
| 104 |
+
Cluster: !Ref ECSCluster
|
| 105 |
+
DesiredCount: 1
|
| 106 |
+
LaunchType: FARGATE
|
| 107 |
+
NetworkConfiguration:
|
| 108 |
+
AwsvpcConfiguration:
|
| 109 |
+
AssignPublicIp: ENABLED
|
| 110 |
+
SecurityGroups:
|
| 111 |
+
- !Ref ECSServiceSecurityGroup
|
| 112 |
+
Subnets:
|
| 113 |
+
- subnet-12345678
|
| 114 |
+
- subnet-87654321
|
| 115 |
+
TaskDefinition: !Ref TaskDefinition
|
| 116 |
+
LoadBalancers:
|
| 117 |
+
- TargetGroupArn: !Ref TargetGroupBlue
|
| 118 |
+
ContainerName: my-container
|
| 119 |
+
ContainerPort: 80
|
| 120 |
+
|
| 121 |
+
ECSServiceGreen:
|
| 122 |
+
Type: AWS::ECS::Service
|
| 123 |
+
Properties:
|
| 124 |
+
Cluster: !Ref ECSCluster
|
| 125 |
+
DesiredCount: 1
|
| 126 |
+
LaunchType: FARGATE
|
| 127 |
+
NetworkConfiguration:
|
| 128 |
+
AwsvpcConfiguration:
|
| 129 |
+
AssignPublicIp: ENABLED
|
| 130 |
+
SecurityGroups:
|
| 131 |
+
- !Ref ECSServiceSecurityGroup
|
| 132 |
+
Subnets:
|
| 133 |
+
- subnet-12345678
|
| 134 |
+
- subnet-87654321
|
| 135 |
+
TaskDefinition: !Ref TaskDefinition
|
| 136 |
+
LoadBalancers:
|
| 137 |
+
- TargetGroupArn: !Ref TargetGroupGreen
|
| 138 |
+
ContainerName: my-container
|
| 139 |
+
ContainerPort: 80
|
| 140 |
+
|
| 141 |
+
TaskDefinition:
|
| 142 |
+
Type: AWS::ECS::TaskDefinition
|
| 143 |
+
Properties:
|
| 144 |
+
Family: my-task-family
|
| 145 |
+
NetworkMode: awsvpc
|
| 146 |
+
RequiresCompatibilities:
|
| 147 |
+
- FARGATE
|
| 148 |
+
Cpu: '256'
|
| 149 |
+
Memory: '512'
|
| 150 |
+
ContainerDefinitions:
|
| 151 |
+
- Name: my-container
|
| 152 |
+
Image: !Sub "${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/my-app-repo:latest"
|
| 153 |
+
Essential: true
|
| 154 |
+
PortMappings:
|
| 155 |
+
- ContainerPort: 80
|
| 156 |
+
Secrets:
|
| 157 |
+
- Name: MY_SECRET
|
| 158 |
+
ValueFrom: !Sub "arn:aws:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:my-secret"
|
| 159 |
+
Environment:
|
| 160 |
+
- Name: CONFIG_PARAM
|
| 161 |
+
Value: !Sub "{{resolve:ssm:/my/config/param}}"
|
| 162 |
+
|
| 163 |
+
CodePipeline:
|
| 164 |
+
Type: AWS::CodePipeline::Pipeline
|
| 165 |
+
Properties:
|
| 166 |
+
RoleArn: !GetAtt CodePipelineRole.Arn
|
| 167 |
+
Stages:
|
| 168 |
+
- Name: Source
|
| 169 |
+
Actions:
|
| 170 |
+
- Name: Source
|
| 171 |
+
ActionTypeId:
|
| 172 |
+
Category: Source
|
| 173 |
+
Owner: AWS
|
| 174 |
+
Provider: CodeCommit
|
| 175 |
+
Version: 1
|
| 176 |
+
OutputArtifacts:
|
| 177 |
+
- Name: SourceOutput
|
| 178 |
+
Configuration:
|
| 179 |
+
RepositoryName: my-repo
|
| 180 |
+
BranchName: main
|
| 181 |
+
- Name: Build
|
| 182 |
+
Actions:
|
| 183 |
+
- Name: Build
|
| 184 |
+
ActionTypeId:
|
| 185 |
+
Category: Build
|
| 186 |
+
Owner: AWS
|
| 187 |
+
Provider: CodeBuild
|
| 188 |
+
Version: 1
|
| 189 |
+
InputArtifacts:
|
| 190 |
+
- Name: SourceOutput
|
| 191 |
+
OutputArtifacts:
|
| 192 |
+
- Name: BuildOutput
|
| 193 |
+
Configuration:
|
| 194 |
+
ProjectName: !Ref CodeBuildProject
|
| 195 |
+
- Name: Approval
|
| 196 |
+
Actions:
|
| 197 |
+
- Name: ManualApproval
|
| 198 |
+
ActionTypeId:
|
| 199 |
+
Category: Approval
|
| 200 |
+
Owner: AWS
|
| 201 |
+
Provider: Manual
|
| 202 |
+
Version: 1
|
| 203 |
+
Configuration:
|
| 204 |
+
CustomData: "Please approve the deployment"
|
| 205 |
+
NotificationArn: !Ref ApprovalSNS
|
| 206 |
+
- Name: Deploy
|
| 207 |
+
Actions:
|
| 208 |
+
- Name: Deploy
|
| 209 |
+
ActionTypeId:
|
| 210 |
+
Category: Deploy
|
| 211 |
+
Owner: AWS
|
| 212 |
+
Provider: CodeDeploy
|
| 213 |
+
Version: 1
|
| 214 |
+
InputArtifacts:
|
| 215 |
+
- Name: BuildOutput
|
| 216 |
+
Configuration:
|
| 217 |
+
ApplicationName: !Ref CodeDeployApplication
|
| 218 |
+
DeploymentGroupName: !Ref CodeDeployDeploymentGroup
|
| 219 |
+
|
| 220 |
+
CodeBuildProject:
|
| 221 |
+
Type: AWS::CodeBuild::Project
|
| 222 |
+
Properties:
|
| 223 |
+
Name: my-build-project
|
| 224 |
+
Source:
|
| 225 |
+
Type: CODEPIPELINE
|
| 226 |
+
Environment:
|
| 227 |
+
ComputeType: BUILD_GENERAL1_SMALL
|
| 228 |
+
Image: aws/codebuild/standard:5.0
|
| 229 |
+
Type: LINUX_CONTAINER
|
| 230 |
+
VpcConfig:
|
| 231 |
+
SecurityGroupIds:
|
| 232 |
+
- !Ref BuildSecurityGroup
|
| 233 |
+
Subnets:
|
| 234 |
+
- subnet-12345678
|
| 235 |
+
- subnet-87654321
|
| 236 |
+
ServiceRole: !GetAtt CodeBuildRole.Arn
|
| 237 |
+
|
| 238 |
+
BuildSecurityGroup:
|
| 239 |
+
Type: AWS::EC2::SecurityGroup
|
| 240 |
+
Properties:
|
| 241 |
+
GroupDescription: Allow build access
|
| 242 |
+
VpcId: vpc-12345678
|
| 243 |
+
|
| 244 |
+
ApprovalSNS:
|
| 245 |
+
Type: AWS::SNS::Topic
|
| 246 |
+
Properties:
|
| 247 |
+
Subscription:
|
| 248 |
+
- Endpoint: my-email@example.com
|
| 249 |
+
Protocol: email
|
| 250 |
+
|
| 251 |
+
CodeDeployApplication:
|
| 252 |
+
Type: AWS::CodeDeploy::Application
|
| 253 |
+
Properties:
|
| 254 |
+
ComputePlatform: ECS
|
| 255 |
+
|
| 256 |
+
CodeDeployDeploymentGroup:
|
| 257 |
+
Type: AWS::CodeDeploy::DeploymentGroup
|
| 258 |
+
Properties:
|
| 259 |
+
ApplicationName: !Ref CodeDeployApplication
|
| 260 |
+
DeploymentConfigName: CodeDeployDefault.ECSCanary10Percent5Minutes
|
| 261 |
+
ServiceRoleArn: !GetAtt CodeDeployRole.Arn
|
| 262 |
+
DeploymentStyle:
|
| 263 |
+
DeploymentType: BLUE_GREEN
|
| 264 |
+
DeploymentOption: WITH_TRAFFIC_CONTROL
|
| 265 |
+
BlueGreenDeploymentConfiguration:
|
| 266 |
+
TerminateBlueInstancesOnDeploymentSuccess:
|
| 267 |
+
Action: TERMINATE
|
| 268 |
+
TerminationWaitTimeInMinutes: 5
|
| 269 |
+
DeploymentReadyOption:
|
| 270 |
+
ActionOnTimeout: CONTINUE_DEPLOYMENT
|
| 271 |
+
WaitTimeInMinutes: 0
|
| 272 |
+
GreenFleetProvisioningOption:
|
| 273 |
+
Action: DISCOVER_EXISTING
|
| 274 |
+
LoadBalancerInfo:
|
| 275 |
+
TargetGroupPairInfoList:
|
| 276 |
+
- TargetGroups:
|
| 277 |
+
- Name: !Ref TargetGroupBlue
|
| 278 |
+
- Name: !Ref TargetGroupGreen
|
| 279 |
+
ProdTrafficRoute:
|
| 280 |
+
ListenerArns:
|
| 281 |
+
- !Ref Listener
|
| 282 |
+
AlarmConfiguration:
|
| 283 |
+
Alarms:
|
| 284 |
+
- Name: !Ref Alarm5xxErrorRate
|
| 285 |
+
- Name: !Ref AlarmP99Latency
|
| 286 |
+
Enabled: true
|
| 287 |
+
IgnorePollAlarmFailure: false
|
| 288 |
+
|
| 289 |
+
Alarm5xxErrorRate:
|
| 290 |
+
Type: AWS::CloudWatch::Alarm
|
| 291 |
+
Properties:
|
| 292 |
+
AlarmName: 5xxErrorRate
|
| 293 |
+
MetricName: HTTPCode_Target_5XX_Count
|
| 294 |
+
Namespace: AWS/ApplicationELB
|
| 295 |
+
Statistic: Sum
|
| 296 |
+
Period: 60
|
| 297 |
+
EvaluationPeriods: 1
|
| 298 |
+
Threshold: 1
|
| 299 |
+
ComparisonOperator: GreaterThanThreshold
|
| 300 |
+
Dimensions:
|
| 301 |
+
- Name: LoadBalancer
|
| 302 |
+
Value: !GetAtt ALB.LoadBalancerFullName
|
| 303 |
+
|
| 304 |
+
AlarmP99Latency:
|
| 305 |
+
Type: AWS::CloudWatch::Alarm
|
| 306 |
+
Properties:
|
| 307 |
+
AlarmName: P99Latency
|
| 308 |
+
MetricName: TargetResponseTime
|
| 309 |
+
Namespace: AWS/ApplicationELB
|
| 310 |
+
Statistic: p99
|
| 311 |
+
Period: 60
|
| 312 |
+
EvaluationPeriods: 1
|
| 313 |
+
Threshold: 1
|
| 314 |
+
ComparisonOperator: GreaterThanThreshold
|
| 315 |
+
Dimensions:
|
| 316 |
+
- Name: LoadBalancer
|
| 317 |
+
Value: !GetAtt ALB.LoadBalancerFullName
|
| 318 |
+
|
| 319 |
+
CodePipelineRole:
|
| 320 |
+
Type: AWS::IAM::Role
|
| 321 |
+
Properties:
|
| 322 |
+
AssumeRolePolicyDocument:
|
| 323 |
+
Version: '2012-10-17'
|
| 324 |
+
Statement:
|
| 325 |
+
- Effect: Allow
|
| 326 |
+
Principal:
|
| 327 |
+
Service: codepipeline.amazonaws.com
|
| 328 |
+
Action: sts:AssumeRole
|
| 329 |
+
Policies:
|
| 330 |
+
- PolicyName: CodePipelinePolicy
|
| 331 |
+
PolicyDocument:
|
| 332 |
+
Version: '2012-10-17'
|
| 333 |
+
Statement:
|
| 334 |
+
- Effect: Allow
|
| 335 |
+
Action:
|
| 336 |
+
- codecommit:GetBranch
|
| 337 |
+
- codecommit:GetCommit
|
| 338 |
+
- codecommit:UploadArchive
|
| 339 |
+
- codecommit:GetUploadArchiveStatus
|
| 340 |
+
- codecommit:CancelUploadArchive
|
| 341 |
+
Resource: "*"
|
| 342 |
+
- Effect: Allow
|
| 343 |
+
Action:
|
| 344 |
+
- codebuild:BatchGetBuilds
|
| 345 |
+
- codebuild:StartBuild
|
| 346 |
+
Resource: "*"
|
| 347 |
+
- Effect: Allow
|
| 348 |
+
Action:
|
| 349 |
+
- codedeploy:CreateDeployment
|
| 350 |
+
- codedeploy:GetApplication
|
| 351 |
+
- codedeploy:GetApplicationRevision
|
| 352 |
+
- codedeploy:GetDeployment
|
| 353 |
+
- codedeploy:GetDeploymentConfig
|
| 354 |
+
- codedeploy:RegisterApplicationRevision
|
| 355 |
+
Resource: "*"
|
| 356 |
+
- Effect: Allow
|
| 357 |
+
Action:
|
| 358 |
+
- sns:Publish
|
| 359 |
+
Resource: !Ref ApprovalSNS
|
| 360 |
+
|
| 361 |
+
CodeBuildRole:
|
| 362 |
+
Type: AWS::IAM::Role
|
| 363 |
+
Properties:
|
| 364 |
+
AssumeRolePolicyDocument:
|
| 365 |
+
Version: '2012-10-17'
|
| 366 |
+
Statement:
|
| 367 |
+
- Effect: Allow
|
| 368 |
+
Principal:
|
| 369 |
+
Service: codebuild.amazonaws.com
|
| 370 |
+
Action: sts:AssumeRole
|
| 371 |
+
Policies:
|
| 372 |
+
- PolicyName: CodeBuildPolicy
|
| 373 |
+
PolicyDocument:
|
| 374 |
+
Version: '2012-10-17'
|
| 375 |
+
Statement:
|
| 376 |
+
- Effect: Allow
|
| 377 |
+
Action:
|
| 378 |
+
- ecr:GetDownloadUrlForLayer
|
| 379 |
+
- ecr:BatchGetImage
|
| 380 |
+
- ecr:BatchCheckLayerAvailability
|
| 381 |
+
Resource: "*"
|
| 382 |
+
- Effect: Allow
|
| 383 |
+
Action:
|
| 384 |
+
- logs:CreateLogGroup
|
| 385 |
+
- logs:CreateLogStream
|
| 386 |
+
- logs:PutLogEvents
|
| 387 |
+
Resource: "*"
|
| 388 |
+
- Effect: Allow
|
| 389 |
+
Action:
|
| 390 |
+
- ssm:GetParameters
|
| 391 |
+
Resource: "*"
|
| 392 |
+
|
| 393 |
+
CodeDeployRole:
|
| 394 |
+
Type: AWS::IAM::Role
|
| 395 |
+
Properties:
|
| 396 |
+
AssumeRolePolicyDocument:
|
| 397 |
+
Version: '2012-10-17'
|
| 398 |
+
Statement:
|
| 399 |
+
- Effect: Allow
|
| 400 |
+
Principal:
|
| 401 |
+
Service: codedeploy.amazonaws.com
|
| 402 |
+
Action: sts:AssumeRole
|
| 403 |
+
Policies:
|
| 404 |
+
- PolicyName: CodeDeployPolicy
|
| 405 |
+
PolicyDocument:
|
| 406 |
+
Version: '2012-10-17'
|
| 407 |
+
Statement:
|
| 408 |
+
- Effect: Allow
|
| 409 |
+
Action:
|
| 410 |
+
- ecs:DescribeServices
|
| 411 |
+
- ecs:UpdateService
|
| 412 |
+
- ecs:DescribeTaskDefinition
|
| 413 |
+
- ecs:DescribeTasks
|
| 414 |
+
- ecs:ListTasks
|
| 415 |
+
Resource: "*"
|
| 416 |
+
- Effect: Allow
|
| 417 |
+
Action:
|
| 418 |
+
- elasticloadbalancing:DescribeTargetGroups
|
| 419 |
+
- elasticloadbalancing:DescribeTargetHealth
|
| 420 |
+
- elasticloadbalancing:ModifyTargetGroup
|
| 421 |
+
Resource: "*"
|
| 422 |
+
- Effect: Allow
|
| 423 |
+
Action:
|
| 424 |
+
- sns:Publish
|
| 425 |
+
Resource: !Ref ApprovalSNS
|
generated/complex/gpt-4o/complex-aws-tf-006/main.tf
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "aws" {
|
| 2 |
+
region = "us-east-1"
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
resource "aws_route53_zone" "primary" {
|
| 6 |
+
name = "example.com"
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
resource "aws_acm_certificate" "cert" {
|
| 10 |
+
domain_name = "example.com"
|
| 11 |
+
validation_method = "DNS"
|
| 12 |
+
|
| 13 |
+
subject_alternative_names = [
|
| 14 |
+
"*.example.com",
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
lifecycle {
|
| 18 |
+
create_before_destroy = true
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
provider = aws.us-east-1
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
resource "aws_acm_certificate_validation" "cert_validation" {
|
| 25 |
+
certificate_arn = aws_acm_certificate.cert.arn
|
| 26 |
+
validation_record_fqdns = [aws_route53_record.cert_validation.fqdn]
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
resource "aws_route53_record" "cert_validation" {
|
| 30 |
+
zone_id = aws_route53_zone.primary.zone_id
|
| 31 |
+
name = aws_acm_certificate.cert.domain_validation_options[0].resource_record_name
|
| 32 |
+
type = aws_acm_certificate.cert.domain_validation_options[0].resource_record_type
|
| 33 |
+
records = [aws_acm_certificate.cert.domain_validation_options[0].resource_record_value]
|
| 34 |
+
ttl = 60
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
resource "aws_cloudfront_distribution" "cdn" {
|
| 38 |
+
origin {
|
| 39 |
+
domain_name = aws_lb.application.dns_name
|
| 40 |
+
origin_id = "alb-origin"
|
| 41 |
+
|
| 42 |
+
custom_origin_config {
|
| 43 |
+
http_port = 80
|
| 44 |
+
https_port = 443
|
| 45 |
+
origin_protocol_policy = "https-only"
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
enabled = true
|
| 50 |
+
is_ipv6_enabled = true
|
| 51 |
+
comment = "CloudFront distribution for example.com"
|
| 52 |
+
default_root_object = "index.html"
|
| 53 |
+
|
| 54 |
+
aliases = ["example.com", "www.example.com"]
|
| 55 |
+
|
| 56 |
+
viewer_certificate {
|
| 57 |
+
acm_certificate_arn = aws_acm_certificate.cert.arn
|
| 58 |
+
ssl_support_method = "sni-only"
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
default_cache_behavior {
|
| 62 |
+
allowed_methods = ["GET", "HEAD", "OPTIONS"]
|
| 63 |
+
cached_methods = ["GET", "HEAD"]
|
| 64 |
+
target_origin_id = "alb-origin"
|
| 65 |
+
|
| 66 |
+
forwarded_values {
|
| 67 |
+
query_string = false
|
| 68 |
+
cookies {
|
| 69 |
+
forward = "none"
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
viewer_protocol_policy = "redirect-to-https"
|
| 74 |
+
min_ttl = 0
|
| 75 |
+
default_ttl = 3600
|
| 76 |
+
max_ttl = 86400
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
restrictions {
|
| 80 |
+
geo_restriction {
|
| 81 |
+
restriction_type = "none"
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
web_acl_id = aws_wafv2_web_acl.waf.arn
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
resource "aws_wafv2_web_acl" "waf" {
|
| 89 |
+
name = "example-waf"
|
| 90 |
+
scope = "CLOUDFRONT"
|
| 91 |
+
description = "WAF for CloudFront and ALB"
|
| 92 |
+
|
| 93 |
+
default_action {
|
| 94 |
+
allow {}
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
rule {
|
| 98 |
+
name = "AWSManagedRulesCommonRuleSet"
|
| 99 |
+
priority = 1
|
| 100 |
+
|
| 101 |
+
override_action {
|
| 102 |
+
none {}
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
statement {
|
| 106 |
+
managed_rule_group_statement {
|
| 107 |
+
name = "AWSManagedRulesCommonRuleSet"
|
| 108 |
+
vendor_name = "AWS"
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
visibility_config {
|
| 113 |
+
cloudwatch_metrics_enabled = true
|
| 114 |
+
metric_name = "AWSManagedRulesCommonRuleSet"
|
| 115 |
+
sampled_requests_enabled = true
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
rule {
|
| 120 |
+
name = "AWSManagedRulesSQLiRuleSet"
|
| 121 |
+
priority = 2
|
| 122 |
+
|
| 123 |
+
override_action {
|
| 124 |
+
none {}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
statement {
|
| 128 |
+
managed_rule_group_statement {
|
| 129 |
+
name = "AWSManagedRulesSQLiRuleSet"
|
| 130 |
+
vendor_name = "AWS"
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
visibility_config {
|
| 135 |
+
cloudwatch_metrics_enabled = true
|
| 136 |
+
metric_name = "AWSManagedRulesSQLiRuleSet"
|
| 137 |
+
sampled_requests_enabled = true
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
rule {
|
| 142 |
+
name = "AWSManagedRulesBotControlRuleSet"
|
| 143 |
+
priority = 3
|
| 144 |
+
|
| 145 |
+
override_action {
|
| 146 |
+
none {}
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
statement {
|
| 150 |
+
managed_rule_group_statement {
|
| 151 |
+
name = "AWSManagedRulesBotControlRuleSet"
|
| 152 |
+
vendor_name = "AWS"
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
visibility_config {
|
| 157 |
+
cloudwatch_metrics_enabled = true
|
| 158 |
+
metric_name = "AWSManagedRulesBotControlRuleSet"
|
| 159 |
+
sampled_requests_enabled = true
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
visibility_config {
|
| 164 |
+
cloudwatch_metrics_enabled = true
|
| 165 |
+
metric_name = "example-waf"
|
| 166 |
+
sampled_requests_enabled = true
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
resource "aws_shield_protection" "cloudfront" {
|
| 171 |
+
name = "example-cloudfront-protection"
|
| 172 |
+
resource_arn = aws_cloudfront_distribution.cdn.arn
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
resource "aws_shield_protection" "alb" {
|
| 176 |
+
name = "example-alb-protection"
|
| 177 |
+
resource_arn = aws_lb.application.arn
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
resource "aws_autoscaling_group" "asg" {
|
| 181 |
+
launch_template {
|
| 182 |
+
id = aws_launch_template.lt.id
|
| 183 |
+
version = "$Latest"
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
mixed_instances_policy {
|
| 187 |
+
launch_template {
|
| 188 |
+
launch_template_specification {
|
| 189 |
+
launch_template_id = aws_launch_template.lt.id
|
| 190 |
+
version = "$Latest"
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
overrides {
|
| 194 |
+
instance_type = "t3.micro"
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
overrides {
|
| 198 |
+
instance_type = "t3a.micro"
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
instances_distribution {
|
| 203 |
+
on_demand_base_capacity = 1
|
| 204 |
+
on_demand_percentage_above_base_capacity = 50
|
| 205 |
+
spot_allocation_strategy = "capacity-optimized"
|
| 206 |
+
}
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
min_size = 1
|
| 210 |
+
max_size = 10
|
| 211 |
+
desired_capacity = 2
|
| 212 |
+
|
| 213 |
+
vpc_zone_identifier = ["subnet-12345678", "subnet-87654321"]
|
| 214 |
+
|
| 215 |
+
health_check_type = "ELB"
|
| 216 |
+
health_check_grace_period = 300
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
resource "aws_launch_template" "lt" {
|
| 220 |
+
name = "example-launch-template"
|
| 221 |
+
|
| 222 |
+
block_device_mappings {
|
| 223 |
+
device_name = "/dev/xvda"
|
| 224 |
+
|
| 225 |
+
ebs {
|
| 226 |
+
delete_on_termination = true
|
| 227 |
+
volume_size = 8
|
| 228 |
+
volume_type = "gp2"
|
| 229 |
+
encrypted = true
|
| 230 |
+
}
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
instance_type = "t3.micro"
|
| 234 |
+
|
| 235 |
+
metadata_options {
|
| 236 |
+
http_tokens = "required"
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
iam_instance_profile {
|
| 240 |
+
name = "example-instance-profile"
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
user_data = base64encode("#!/bin/bash\nyum install -y amazon-ssm-agent\n")
|
| 244 |
+
|
| 245 |
+
lifecycle {
|
| 246 |
+
create_before_destroy = true
|
| 247 |
+
}
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
resource "aws_rds_cluster" "aurora" {
|
| 251 |
+
cluster_identifier = "aurora-cluster"
|
| 252 |
+
engine = "aurora-mysql"
|
| 253 |
+
engine_version = "5.7.mysql_aurora.2.07.1"
|
| 254 |
+
master_username = "admin"
|
| 255 |
+
master_password = "password"
|
| 256 |
+
backup_retention_period = 5
|
| 257 |
+
preferred_backup_window = "07:00-09:00"
|
| 258 |
+
availability_zones = ["us-east-1a", "us-east-1b", "us-east-1c"]
|
| 259 |
+
|
| 260 |
+
global_cluster_identifier = "aurora-global-cluster"
|
| 261 |
+
source_region = "us-east-1"
|
| 262 |
+
enable_global_write_forwarding = true
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
resource "aws_ssm_parameter" "session_manager" {
|
| 266 |
+
name = "/example/ssm/session-manager"
|
| 267 |
+
type = "String"
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "aws" {
|
| 2 |
+
region = "us-east-1"
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
resource "aws_kms_key" "raw_tier" {
|
| 6 |
+
description = "KMS key for raw data tier"
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
resource "aws_kms_key" "curated_tier" {
|
| 10 |
+
description = "KMS key for curated data tier"
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
resource "aws_s3_bucket" "raw_data" {
|
| 14 |
+
bucket = "my-raw-data-bucket"
|
| 15 |
+
server_side_encryption_configuration {
|
| 16 |
+
rule {
|
| 17 |
+
apply_server_side_encryption_by_default {
|
| 18 |
+
sse_algorithm = "aws:kms"
|
| 19 |
+
kms_master_key_id = aws_kms_key.raw_tier.arn
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
bucket_key_enabled = true
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
resource "aws_s3_bucket" "curated_data" {
|
| 27 |
+
bucket = "my-curated-data-bucket"
|
| 28 |
+
server_side_encryption_configuration {
|
| 29 |
+
rule {
|
| 30 |
+
apply_server_side_encryption_by_default {
|
| 31 |
+
sse_algorithm = "aws:kms"
|
| 32 |
+
kms_master_key_id = aws_kms_key.curated_tier.arn
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
bucket_key_enabled = true
|
| 37 |
+
lifecycle_rule {
|
| 38 |
+
id = "IntelligentTiering"
|
| 39 |
+
enabled = true
|
| 40 |
+
transitions {
|
| 41 |
+
days = 30
|
| 42 |
+
storage_class = "INTELLIGENT_TIERING"
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
resource "aws_lakeformation_data_lake_settings" "default" {
|
| 48 |
+
admins = ["arn:aws:iam::123456789012:user/Admin"]
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
resource "aws_glue_crawler" "raw_crawler" {
|
| 52 |
+
name = "raw-data-crawler"
|
| 53 |
+
role = "arn:aws:iam::123456789012:role/AWSGlueServiceRole"
|
| 54 |
+
database_name = "raw_data_db"
|
| 55 |
+
s3_target {
|
| 56 |
+
path = aws_s3_bucket.raw_data.arn
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
resource "aws_glue_job" "etl_job" {
|
| 61 |
+
name = "raw-to-curated-etl"
|
| 62 |
+
role_arn = "arn:aws:iam::123456789012:role/AWSGlueServiceRole"
|
| 63 |
+
command {
|
| 64 |
+
name = "glueetl"
|
| 65 |
+
script_location = "s3://my-script-bucket/scripts/etl_script.py"
|
| 66 |
+
}
|
| 67 |
+
default_arguments = {
|
| 68 |
+
"--job-bookmark-option" = "job-bookmark-enable"
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
resource "aws_athena_workgroup" "primary" {
|
| 73 |
+
name = "primary"
|
| 74 |
+
configuration {
|
| 75 |
+
result_configuration {
|
| 76 |
+
output_location = "s3://my-athena-results/"
|
| 77 |
+
encryption_configuration {
|
| 78 |
+
encryption_option = "SSE_KMS"
|
| 79 |
+
kms_key_arn = aws_kms_key.curated_tier.arn
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
enforce_workgroup_configuration = true
|
| 83 |
+
publish_cloudwatch_metrics_enabled = true
|
| 84 |
+
bytes_scanned_cutoff_per_query = 1000000000
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
resource "aws_redshiftserverless_namespace" "default" {
|
| 89 |
+
namespace_name = "my_namespace"
|
| 90 |
+
admin_username = "admin"
|
| 91 |
+
admin_user_password = "YourPassword123"
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
resource "aws_kinesis_firehose_delivery_stream" "raw_delivery" {
|
| 95 |
+
name = "raw-delivery-stream"
|
| 96 |
+
destination = "extended_s3"
|
| 97 |
+
|
| 98 |
+
extended_s3_configuration {
|
| 99 |
+
role_arn = "arn:aws:iam::123456789012:role/FirehoseDeliveryRole"
|
| 100 |
+
bucket_arn = aws_s3_bucket.raw_data.arn
|
| 101 |
+
buffering_hints {
|
| 102 |
+
size_in_mbs = 128
|
| 103 |
+
interval_in_seconds = 300
|
| 104 |
+
}
|
| 105 |
+
data_format_conversion_configuration {
|
| 106 |
+
enabled = true
|
| 107 |
+
input_format_configuration {
|
| 108 |
+
deserializer {
|
| 109 |
+
open_x_json_ser_de {}
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
output_format_configuration {
|
| 113 |
+
serializer {
|
| 114 |
+
parquet_ser_de {}
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
dynamic_partitioning_configuration {
|
| 119 |
+
enabled = true
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
resource "aws_sfn_state_machine" "glue_etl_pipeline" {
|
| 125 |
+
name = "GlueETLPipeline"
|
| 126 |
+
role_arn = "arn:aws:iam::123456789012:role/StepFunctionsExecutionRole"
|
| 127 |
+
definition = <<EOF
|
| 128 |
+
{
|
| 129 |
+
"Comment": "A simple AWS Step Functions state machine that orchestrates Glue ETL jobs.",
|
| 130 |
+
"StartAt": "StartETLJob",
|
| 131 |
+
"States": {
|
| 132 |
+
"StartETLJob": {
|
| 133 |
+
"Type": "Task",
|
| 134 |
+
"Resource": "arn:aws:states:::glue:startJobRun.sync",
|
| 135 |
+
"Parameters": {
|
| 136 |
+
"JobName": "${aws_glue_job.etl_job.name}"
|
| 137 |
+
},
|
| 138 |
+
"Next": "SuccessState",
|
| 139 |
+
"Catch": [
|
| 140 |
+
{
|
| 141 |
+
"ErrorEquals": ["States.ALL"],
|
| 142 |
+
"ResultPath": "$.error-info",
|
| 143 |
+
"Next": "FailureNotification"
|
| 144 |
+
}
|
| 145 |
+
]
|
| 146 |
+
},
|
| 147 |
+
"SuccessState": {
|
| 148 |
+
"Type": "Succeed"
|
| 149 |
+
},
|
| 150 |
+
"FailureNotification": {
|
| 151 |
+
"Type": "Task",
|
| 152 |
+
"Resource": "arn:aws:states:::sns:publish",
|
| 153 |
+
"Parameters": {
|
| 154 |
+
"TopicArn": "arn:aws:sns:us-east-1:123456789012:ETLFailureTopic",
|
| 155 |
+
"Message": "ETL job failed: $.error-info"
|
| 156 |
+
},
|
| 157 |
+
"End": true
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
EOF
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
resource "aws_cloudwatch_dashboard" "data_freshness" {
|
| 165 |
+
dashboard_name = "DataFreshnessMetrics"
|
| 166 |
+
dashboard_body = <<EOF
|
| 167 |
+
{
|
| 168 |
+
"widgets": [
|
| 169 |
+
{
|
| 170 |
+
"type": "metric",
|
| 171 |
+
"x": 0,
|
| 172 |
+
"y": 0,
|
| 173 |
+
"width": 24,
|
| 174 |
+
"height": 6,
|
| 175 |
+
"properties": {
|
| 176 |
+
"metrics": [
|
| 177 |
+
[ "AWS/Glue", "BytesProcessed", "JobName", "${aws_glue_job.etl_job.name}" ],
|
| 178 |
+
[ ".", "JobDuration", ".", "." ]
|
| 179 |
+
],
|
| 180 |
+
"period": 300,
|
| 181 |
+
"stat": "Sum",
|
| 182 |
+
"region": "us-east-1",
|
| 183 |
+
"title": "Glue ETL Job Metrics"
|
| 184 |
+
}
|
| 185 |
+
}
|
| 186 |
+
]
|
| 187 |
+
}
|
| 188 |
+
EOF
|
| 189 |
+
}
|
generated/complex/gpt-4o/complex-aws-tf-008/main.tf
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "aws" {
|
| 2 |
+
region = "us-east-1"
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
resource "aws_organizations_organizational_unit" "aft_ou" {
|
| 6 |
+
name = "AFT-Accounts"
|
| 7 |
+
parent_id = "r-examplerootid"
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
resource "aws_organizations_policy" "deny_regions" {
|
| 11 |
+
name = "DenyRegionsOutsideUSEast1EUWest1"
|
| 12 |
+
description = "Deny access to regions outside us-east-1 and eu-west-1"
|
| 13 |
+
content = jsonencode({
|
| 14 |
+
"Version": "2012-10-17",
|
| 15 |
+
"Statement": [
|
| 16 |
+
{
|
| 17 |
+
"Effect": "Deny",
|
| 18 |
+
"Action": "*",
|
| 19 |
+
"Resource": "*",
|
| 20 |
+
"Condition": {
|
| 21 |
+
"StringNotEquals": {
|
| 22 |
+
"aws:RequestedRegion": ["us-east-1", "eu-west-1"]
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
]
|
| 27 |
+
})
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
resource "aws_organizations_policy" "deny_iam_users_console_access" {
|
| 31 |
+
name = "DenyIAMUsersConsoleAccess"
|
| 32 |
+
description = "Deny creation of IAM users with console access"
|
| 33 |
+
content = jsonencode({
|
| 34 |
+
"Version": "2012-10-17",
|
| 35 |
+
"Statement": [
|
| 36 |
+
{
|
| 37 |
+
"Effect": "Deny",
|
| 38 |
+
"Action": "iam:CreateUser",
|
| 39 |
+
"Resource": "*",
|
| 40 |
+
"Condition": {
|
| 41 |
+
"Bool": {
|
| 42 |
+
"aws:RequestTag/ConsoleAccess": "true"
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
]
|
| 47 |
+
})
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
resource "aws_organizations_policy" "require_imdsv2" {
|
| 51 |
+
name = "RequireIMDSv2"
|
| 52 |
+
description = "Require IMDSv2 on all EC2 instances"
|
| 53 |
+
content = jsonencode({
|
| 54 |
+
"Version": "2012-10-17",
|
| 55 |
+
"Statement": [
|
| 56 |
+
{
|
| 57 |
+
"Effect": "Deny",
|
| 58 |
+
"Action": "ec2:RunInstances",
|
| 59 |
+
"Resource": "arn:aws:ec2:*:*:instance/*",
|
| 60 |
+
"Condition": {
|
| 61 |
+
"StringNotEquals": {
|
| 62 |
+
"ec2:MetadataHttpTokens": "required"
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
]
|
| 67 |
+
})
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
resource "aws_s3_bucket" "terraform_state" {
|
| 71 |
+
bucket = "aft-terraform-state-bucket"
|
| 72 |
+
versioning {
|
| 73 |
+
enabled = true
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
resource "aws_dynamodb_table" "terraform_lock" {
|
| 78 |
+
name = "AFTTerraformLock"
|
| 79 |
+
billing_mode = "PAY_PER_REQUEST"
|
| 80 |
+
hash_key = "LockID"
|
| 81 |
+
|
| 82 |
+
attribute {
|
| 83 |
+
name = "LockID"
|
| 84 |
+
type = "S"
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
resource "aws_iam_role" "cross_account_role" {
|
| 89 |
+
name = "AFTCrossAccountRole"
|
| 90 |
+
|
| 91 |
+
assume_role_policy = jsonencode({
|
| 92 |
+
"Version": "2012-10-17",
|
| 93 |
+
"Statement": [
|
| 94 |
+
{
|
| 95 |
+
"Effect": "Allow",
|
| 96 |
+
"Principal": {
|
| 97 |
+
"AWS": "arn:aws:iam::<management_account_id>:role/CI-CD-Pipeline-Role"
|
| 98 |
+
},
|
| 99 |
+
"Action": "sts:AssumeRole",
|
| 100 |
+
"Condition": {
|
| 101 |
+
"StringEquals": {
|
| 102 |
+
"sts:ExternalId": "external-id-condition"
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
]
|
| 107 |
+
})
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
resource "aws_vpc" "main" {
|
| 111 |
+
cidr_block = "10.0.0.0/16"
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
resource "aws_subnet" "public" {
|
| 115 |
+
count = 3
|
| 116 |
+
vpc_id = aws_vpc.main.id
|
| 117 |
+
cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 8, count.index)
|
| 118 |
+
availability_zone = element(data.aws_availability_zones.available.names, count.index)
|
| 119 |
+
map_public_ip_on_launch = true
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
resource "aws_subnet" "private" {
|
| 123 |
+
count = 3
|
| 124 |
+
vpc_id = aws_vpc.main.id
|
| 125 |
+
cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 8, count.index + 3)
|
| 126 |
+
availability_zone = element(data.aws_availability_zones.available.names, count.index)
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
resource "aws_subnet" "isolated" {
|
| 130 |
+
count = 3
|
| 131 |
+
vpc_id = aws_vpc.main.id
|
| 132 |
+
cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 8, count.index + 6)
|
| 133 |
+
availability_zone = element(data.aws_availability_zones.available.names, count.index)
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
resource "aws_vpc_endpoint" "s3" {
|
| 137 |
+
vpc_id = aws_vpc.main.id
|
| 138 |
+
service_name = "com.amazonaws.us-east-1.s3"
|
| 139 |
+
vpc_endpoint_type = "Gateway"
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
resource "aws_vpc_endpoint" "dynamodb" {
|
| 143 |
+
vpc_id = aws_vpc.main.id
|
| 144 |
+
service_name = "com.amazonaws.us-east-1.dynamodb"
|
| 145 |
+
vpc_endpoint_type = "Gateway"
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
resource "aws_vpc_endpoint" "ssm" {
|
| 149 |
+
vpc_id = aws_vpc.main.id
|
| 150 |
+
service_name = "com.amazonaws.us-east-1.ssm"
|
| 151 |
+
vpc_endpoint_type = "Interface"
|
| 152 |
+
private_dns_enabled = true
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
resource "aws_vpc_endpoint" "ecr" {
|
| 156 |
+
vpc_id = aws_vpc.main.id
|
| 157 |
+
service_name = "com.amazonaws.us-east-1.ecr.api"
|
| 158 |
+
vpc_endpoint_type = "Interface"
|
| 159 |
+
private_dns_enabled = true
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
resource "aws_vpc_endpoint" "cloudwatch_logs" {
|
| 163 |
+
vpc_id = aws_vpc.main.id
|
| 164 |
+
service_name = "com.amazonaws.us-east-1.logs"
|
| 165 |
+
vpc_endpoint_type = "Interface"
|
| 166 |
+
private_dns_enabled = true
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
resource "aws_vpc_endpoint" "kms" {
|
| 170 |
+
vpc_id = aws_vpc.main.id
|
| 171 |
+
service_name = "com.amazonaws.us-east-1.kms"
|
| 172 |
+
vpc_endpoint_type = "Interface"
|
| 173 |
+
private_dns_enabled = true
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
resource "aws_vpc_endpoint" "sts" {
|
| 177 |
+
vpc_id = aws_vpc.main.id
|
| 178 |
+
service_name = "com.amazonaws.us-east-1.sts"
|
| 179 |
+
vpc_endpoint_type = "Interface"
|
| 180 |
+
private_dns_enabled = true
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
resource "aws_ssoadmin_permission_set" "example" {
|
| 184 |
+
instance_arn = data.aws_ssoadmin_instances.main.arn
|
| 185 |
+
name = "ExamplePermissionSet"
|
| 186 |
+
description = "Example permission set for Azure AD group"
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
resource "aws_ssoadmin_account_assignment" "example" {
|
| 190 |
+
instance_arn = data.aws_ssoadmin_instances.main.arn
|
| 191 |
+
permission_set_arn = aws_ssoadmin_permission_set.example.arn
|
| 192 |
+
principal_id = "AzureADGroupID"
|
| 193 |
+
principal_type = "GROUP"
|
| 194 |
+
target_id = "AWSAccountID"
|
| 195 |
+
target_type = "AWS_ACCOUNT"
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
data "aws_availability_zones" "available" {}
|
| 199 |
+
|
| 200 |
+
data "aws_ssoadmin_instances" "main" {}
|
generated/complex/gpt-4o/complex-aws-tf-009/main.yaml
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
AWSTemplateFormatVersion: '2010-09-09'
|
| 2 |
+
Resources:
|
| 3 |
+
KinesisDataStream:
|
| 4 |
+
Type: AWS::Kinesis::Stream
|
| 5 |
+
Properties:
|
| 6 |
+
ShardCount: 1
|
| 7 |
+
StreamEncryption:
|
| 8 |
+
EncryptionType: KMS
|
| 9 |
+
KeyId: !Ref KinesisKMSKey
|
| 10 |
+
|
| 11 |
+
KinesisKMSKey:
|
| 12 |
+
Type: AWS::KMS::Key
|
| 13 |
+
Properties:
|
| 14 |
+
Description: KMS key for Kinesis Data Stream encryption
|
| 15 |
+
KeyPolicy:
|
| 16 |
+
Version: '2012-10-17'
|
| 17 |
+
Statement:
|
| 18 |
+
- Effect: Allow
|
| 19 |
+
Principal:
|
| 20 |
+
AWS: !Sub arn:aws:iam::${AWS::AccountId}:root
|
| 21 |
+
Action: kms:*
|
| 22 |
+
Resource: '*'
|
| 23 |
+
|
| 24 |
+
KinesisDataAnalyticsApplication:
|
| 25 |
+
Type: AWS::KinesisAnalyticsV2::Application
|
| 26 |
+
Properties:
|
| 27 |
+
ApplicationName: FraudDetectionApp
|
| 28 |
+
RuntimeEnvironment: FLINK-1_11
|
| 29 |
+
ServiceExecutionRole: !GetAtt KinesisAnalyticsRole.Arn
|
| 30 |
+
ApplicationConfiguration:
|
| 31 |
+
ApplicationCodeConfiguration:
|
| 32 |
+
CodeContent:
|
| 33 |
+
S3ContentLocation:
|
| 34 |
+
BucketARN: !Sub arn:aws:s3:::${ModelS3Bucket}
|
| 35 |
+
FileKey: flink-app-code.jar
|
| 36 |
+
ObjectVersion: !Ref ModelS3ObjectVersion
|
| 37 |
+
CodeContentType: ZIPFILE
|
| 38 |
+
FlinkApplicationConfiguration:
|
| 39 |
+
CheckpointConfiguration:
|
| 40 |
+
ConfigurationType: CUSTOM
|
| 41 |
+
CheckpointInterval: 60000
|
| 42 |
+
CheckpointingEnabled: true
|
| 43 |
+
MonitoringConfiguration:
|
| 44 |
+
ConfigurationType: CUSTOM
|
| 45 |
+
LogLevel: INFO
|
| 46 |
+
ParallelismConfiguration:
|
| 47 |
+
ConfigurationType: CUSTOM
|
| 48 |
+
Parallelism: 2
|
| 49 |
+
ParallelismPerKPU: 1
|
| 50 |
+
AutoScalingEnabled: true
|
| 51 |
+
ApplicationSnapshotConfiguration:
|
| 52 |
+
SnapshotsEnabled: true
|
| 53 |
+
|
| 54 |
+
ModelS3Bucket:
|
| 55 |
+
Type: AWS::S3::Bucket
|
| 56 |
+
Properties:
|
| 57 |
+
VersioningConfiguration:
|
| 58 |
+
Status: Enabled
|
| 59 |
+
|
| 60 |
+
ModelS3ObjectVersion:
|
| 61 |
+
Type: AWS::S3::BucketVersioning
|
| 62 |
+
Properties:
|
| 63 |
+
Bucket: !Ref ModelS3Bucket
|
| 64 |
+
Status: Enabled
|
| 65 |
+
|
| 66 |
+
VPCGatewayEndpoint:
|
| 67 |
+
Type: AWS::EC2::VPCEndpoint
|
| 68 |
+
Properties:
|
| 69 |
+
ServiceName: com.amazonaws.us-east-1.s3
|
| 70 |
+
VpcId: !Ref VPCId
|
| 71 |
+
RouteTableIds:
|
| 72 |
+
- !Ref RouteTableId
|
| 73 |
+
|
| 74 |
+
LambdaFunction:
|
| 75 |
+
Type: AWS::Lambda::Function
|
| 76 |
+
Properties:
|
| 77 |
+
Handler: index.handler
|
| 78 |
+
Role: !GetAtt LambdaExecutionRole.Arn
|
| 79 |
+
Code:
|
| 80 |
+
S3Bucket: !Ref LambdaCodeBucket
|
| 81 |
+
S3Key: lambda-code.zip
|
| 82 |
+
Runtime: python3.8
|
| 83 |
+
Environment:
|
| 84 |
+
Variables:
|
| 85 |
+
DYNAMODB_TABLE_NAME: !Ref DynamoDBTable
|
| 86 |
+
|
| 87 |
+
LambdaExecutionRole:
|
| 88 |
+
Type: AWS::IAM::Role
|
| 89 |
+
Properties:
|
| 90 |
+
AssumeRolePolicyDocument:
|
| 91 |
+
Version: '2012-10-17'
|
| 92 |
+
Statement:
|
| 93 |
+
- Effect: Allow
|
| 94 |
+
Principal:
|
| 95 |
+
Service: lambda.amazonaws.com
|
| 96 |
+
Action: sts:AssumeRole
|
| 97 |
+
Policies:
|
| 98 |
+
- PolicyName: LambdaDynamoDBPolicy
|
| 99 |
+
PolicyDocument:
|
| 100 |
+
Version: '2012-10-17'
|
| 101 |
+
Statement:
|
| 102 |
+
- Effect: Allow
|
| 103 |
+
Action:
|
| 104 |
+
- dynamodb:PutItem
|
| 105 |
+
Resource: !GetAtt DynamoDBTable.Arn
|
| 106 |
+
|
| 107 |
+
DynamoDBTable:
|
| 108 |
+
Type: AWS::DynamoDB::Table
|
| 109 |
+
Properties:
|
| 110 |
+
BillingMode: PAY_PER_REQUEST
|
| 111 |
+
AttributeDefinitions:
|
| 112 |
+
- AttributeName: ID
|
| 113 |
+
AttributeType: S
|
| 114 |
+
KeySchema:
|
| 115 |
+
- AttributeName: ID
|
| 116 |
+
KeyType: HASH
|
| 117 |
+
TimeToLiveSpecification:
|
| 118 |
+
AttributeName: TTL
|
| 119 |
+
Enabled: true
|
| 120 |
+
|
| 121 |
+
DynamoDBKMSKey:
|
| 122 |
+
Type: AWS::KMS::Key
|
| 123 |
+
Properties:
|
| 124 |
+
Description: KMS key for DynamoDB encryption
|
| 125 |
+
KeyPolicy:
|
| 126 |
+
Version: '2012-10-17'
|
| 127 |
+
Statement:
|
| 128 |
+
- Effect: Allow
|
| 129 |
+
Principal:
|
| 130 |
+
AWS: !Sub arn:aws:iam::${AWS::AccountId}:root
|
| 131 |
+
Action: kms:*
|
| 132 |
+
Resource: '*'
|
| 133 |
+
|
| 134 |
+
SNSTopic:
|
| 135 |
+
Type: AWS::SNS::Topic
|
| 136 |
+
Properties:
|
| 137 |
+
TopicName: FraudAlerts
|
| 138 |
+
Subscription:
|
| 139 |
+
- Protocol: https
|
| 140 |
+
Endpoint: https://events.pagerduty.com/integration/your_integration_key/enqueue
|
| 141 |
+
FilterPolicy:
|
| 142 |
+
severity: ["high"]
|
| 143 |
+
- Protocol: sqs
|
| 144 |
+
Endpoint: !GetAtt SQSQueue.Arn
|
| 145 |
+
FilterPolicy:
|
| 146 |
+
severity: ["medium"]
|
| 147 |
+
|
| 148 |
+
SQSQueue:
|
| 149 |
+
Type: AWS::SQS::Queue
|
| 150 |
+
|
| 151 |
+
CloudWatchDashboard:
|
| 152 |
+
Type: AWS::CloudWatch::Dashboard
|
| 153 |
+
Properties:
|
| 154 |
+
DashboardName: FraudDetectionDashboard
|
| 155 |
+
DashboardBody: !Sub |
|
| 156 |
+
{
|
| 157 |
+
"widgets": [
|
| 158 |
+
{
|
| 159 |
+
"type": "metric",
|
| 160 |
+
"x": 0,
|
| 161 |
+
"y": 0,
|
| 162 |
+
"width": 6,
|
| 163 |
+
"height": 6,
|
| 164 |
+
"properties": {
|
| 165 |
+
"metrics": [
|
| 166 |
+
[ "AWS/Kinesis", "IncomingRecords", "StreamName", "${KinesisDataStream}" ],
|
| 167 |
+
[ ".", "IncomingBytes", ".", "." ]
|
| 168 |
+
],
|
| 169 |
+
"period": 60,
|
| 170 |
+
"stat": "Sum",
|
| 171 |
+
"region": "${AWS::Region}",
|
| 172 |
+
"title": "Events Processed Per Second"
|
| 173 |
+
}
|
| 174 |
+
},
|
| 175 |
+
{
|
| 176 |
+
"type": "metric",
|
| 177 |
+
"x": 6,
|
| 178 |
+
"y": 0,
|
| 179 |
+
"width": 6,
|
| 180 |
+
"height": 6,
|
| 181 |
+
"properties": {
|
| 182 |
+
"metrics": [
|
| 183 |
+
[ "AWS/Lambda", "Duration", "FunctionName", "${LambdaFunction}" ]
|
| 184 |
+
],
|
| 185 |
+
"period": 60,
|
| 186 |
+
"stat": "Average",
|
| 187 |
+
"region": "${AWS::Region}",
|
| 188 |
+
"title": "Anomaly Detection Latency"
|
| 189 |
+
}
|
| 190 |
+
},
|
| 191 |
+
{
|
| 192 |
+
"type": "metric",
|
| 193 |
+
"x": 12,
|
| 194 |
+
"y": 0,
|
| 195 |
+
"width": 6,
|
| 196 |
+
"height": 6,
|
| 197 |
+
"properties": {
|
| 198 |
+
"metrics": [
|
| 199 |
+
[ "AWS/Kinesis", "GetRecords.IteratorAgeMilliseconds", "StreamName", "${KinesisDataStream}" ]
|
| 200 |
+
],
|
| 201 |
+
"period": 60,
|
| 202 |
+
"stat": "Maximum",
|
| 203 |
+
"region": "${AWS::Region}",
|
| 204 |
+
"title": "Iterator Age"
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
+
]
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
CloudWatchCompositeAlarm:
|
| 211 |
+
Type: AWS::CloudWatch::CompositeAlarm
|
| 212 |
+
Properties:
|
| 213 |
+
AlarmName: KinesisScalingAlarm
|
| 214 |
+
AlarmRule: !Sub |
|
| 215 |
+
ALARM("${KinesisIncomingRecordsAlarm}") OR ALARM("${KinesisIteratorAgeAlarm}")
|
| 216 |
+
ActionsEnabled: true
|
| 217 |
+
AlarmActions:
|
| 218 |
+
- !Ref AutoScalingPolicy
|
| 219 |
+
|
| 220 |
+
KinesisIncomingRecordsAlarm:
|
| 221 |
+
Type: AWS::CloudWatch::Alarm
|
| 222 |
+
Properties:
|
| 223 |
+
AlarmName: KinesisIncomingRecordsAlarm
|
| 224 |
+
MetricName: IncomingRecords
|
| 225 |
+
Namespace: AWS/Kinesis
|
| 226 |
+
Statistic: Sum
|
| 227 |
+
Period: 60
|
| 228 |
+
EvaluationPeriods: 1
|
| 229 |
+
Threshold: 1000
|
| 230 |
+
ComparisonOperator: GreaterThanThreshold
|
| 231 |
+
Dimensions:
|
| 232 |
+
- Name: StreamName
|
| 233 |
+
Value: !Ref KinesisDataStream
|
| 234 |
+
|
| 235 |
+
KinesisIteratorAgeAlarm:
|
| 236 |
+
Type: AWS::CloudWatch::Alarm
|
| 237 |
+
Properties:
|
| 238 |
+
AlarmName: KinesisIteratorAgeAlarm
|
| 239 |
+
MetricName: GetRecords.IteratorAgeMilliseconds
|
| 240 |
+
Namespace: AWS/Kinesis
|
| 241 |
+
Statistic: Maximum
|
| 242 |
+
Period: 60
|
| 243 |
+
EvaluationPeriods: 1
|
| 244 |
+
Threshold: 30000
|
| 245 |
+
ComparisonOperator: GreaterThanThreshold
|
| 246 |
+
Dimensions:
|
| 247 |
+
- Name: StreamName
|
| 248 |
+
Value: !Ref KinesisDataStream
|
| 249 |
+
|
| 250 |
+
AutoScalingPolicy:
|
| 251 |
+
Type: AWS::ApplicationAutoScaling::ScalingPolicy
|
| 252 |
+
Properties:
|
| 253 |
+
PolicyName: KinesisScalingPolicy
|
| 254 |
+
PolicyType: TargetTrackingScaling
|
| 255 |
+
ResourceId: !Sub stream/${KinesisDataStream}
|
| 256 |
+
ScalableDimension: kinesis:stream:WriteCapacityUnits
|
| 257 |
+
ServiceNamespace: kinesis
|
| 258 |
+
TargetTrackingScalingPolicyConfiguration:
|
| 259 |
+
TargetValue: 70.0
|
| 260 |
+
PredefinedMetricSpecification:
|
| 261 |
+
PredefinedMetricType: KinesisWriteCapacityUtilization
|
| 262 |
+
ScaleInCooldown: 60
|
| 263 |
+
ScaleOutCooldown: 60
|
| 264 |
+
|
| 265 |
+
LambdaCodeBucket:
|
| 266 |
+
Type: AWS::S3::Bucket
|
| 267 |
+
Properties:
|
| 268 |
+
VersioningConfiguration:
|
| 269 |
+
Status: Enabled
|
| 270 |
+
|
| 271 |
+
VPCId:
|
| 272 |
+
Type: AWS::EC2::VPC
|
| 273 |
+
Properties:
|
| 274 |
+
CidrBlock: 10.0.0.0/16
|
| 275 |
+
|
| 276 |
+
RouteTableId:
|
| 277 |
+
Type: AWS::EC2::RouteTable
|
| 278 |
+
Properties:
|
| 279 |
+
VpcId: !Ref VPCId
|
generated/complex/gpt-4o/complex-aws-tf-010/main.tf
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "aws" {
|
| 2 |
+
region = "us-east-1"
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
provider "aws" {
|
| 6 |
+
alias = "dr"
|
| 7 |
+
region = "us-west-2"
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
resource "aws_eks_cluster" "primary" {
|
| 11 |
+
name = "primary-eks-cluster"
|
| 12 |
+
role_arn = aws_iam_role.eks_role.arn
|
| 13 |
+
|
| 14 |
+
vpc_config {
|
| 15 |
+
subnet_ids = aws_subnet.eks_subnets[*].id
|
| 16 |
+
}
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
resource "aws_eks_node_group" "primary" {
|
| 20 |
+
cluster_name = aws_eks_cluster.primary.name
|
| 21 |
+
node_group_name = "primary-node-group"
|
| 22 |
+
node_role_arn = aws_iam_role.node_role.arn
|
| 23 |
+
subnet_ids = aws_subnet.eks_subnets[*].id
|
| 24 |
+
|
| 25 |
+
scaling_config {
|
| 26 |
+
desired_size = 3
|
| 27 |
+
max_size = 5
|
| 28 |
+
min_size = 1
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
resource "aws_eks_cluster" "dr" {
|
| 33 |
+
provider = aws.dr
|
| 34 |
+
|
| 35 |
+
name = "dr-eks-cluster"
|
| 36 |
+
role_arn = aws_iam_role.eks_role.arn
|
| 37 |
+
|
| 38 |
+
vpc_config {
|
| 39 |
+
subnet_ids = aws_subnet.dr_eks_subnets[*].id
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
resource "aws_eks_node_group" "dr" {
|
| 44 |
+
provider = aws.dr
|
| 45 |
+
|
| 46 |
+
cluster_name = aws_eks_cluster.dr.name
|
| 47 |
+
node_group_name = "dr-node-group"
|
| 48 |
+
node_role_arn = aws_iam_role.node_role.arn
|
| 49 |
+
subnet_ids = aws_subnet.dr_eks_subnets[*].id
|
| 50 |
+
|
| 51 |
+
scaling_config {
|
| 52 |
+
desired_size = 0
|
| 53 |
+
max_size = 5
|
| 54 |
+
min_size = 0
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
resource "aws_rds_cluster" "primary" {
|
| 59 |
+
cluster_identifier = "primary-rds-cluster"
|
| 60 |
+
engine = "aurora-postgresql"
|
| 61 |
+
master_username = "admin"
|
| 62 |
+
master_password = "password"
|
| 63 |
+
availability_zones = ["us-east-1a", "us-east-1b"]
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
resource "aws_rds_cluster_instance" "primary_instance" {
|
| 67 |
+
cluster_identifier = aws_rds_cluster.primary.id
|
| 68 |
+
instance_class = "db.r5.large"
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
resource "aws_rds_cluster" "dr" {
|
| 72 |
+
provider = aws.dr
|
| 73 |
+
cluster_identifier = "dr-rds-cluster"
|
| 74 |
+
engine = "aurora-postgresql"
|
| 75 |
+
master_username = "admin"
|
| 76 |
+
master_password = "password"
|
| 77 |
+
availability_zones = ["us-west-2a", "us-west-2b"]
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
resource "aws_rds_cluster_instance" "dr_instance" {
|
| 81 |
+
provider = aws.dr
|
| 82 |
+
cluster_identifier = aws_rds_cluster.dr.id
|
| 83 |
+
instance_class = "db.r5.large"
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
resource "aws_s3_bucket" "primary" {
|
| 87 |
+
bucket = "primary-bucket"
|
| 88 |
+
acl = "private"
|
| 89 |
+
|
| 90 |
+
versioning {
|
| 91 |
+
enabled = true
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
replication_configuration {
|
| 95 |
+
role = aws_iam_role.replication_role.arn
|
| 96 |
+
|
| 97 |
+
rules {
|
| 98 |
+
id = "replication-rule"
|
| 99 |
+
status = "Enabled"
|
| 100 |
+
|
| 101 |
+
destination {
|
| 102 |
+
bucket = aws_s3_bucket.dr.arn
|
| 103 |
+
storage_class = "STANDARD"
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
resource "aws_s3_bucket" "dr" {
|
| 110 |
+
provider = aws.dr
|
| 111 |
+
bucket = "dr-bucket"
|
| 112 |
+
acl = "private"
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
resource "aws_elasticache_replication_group" "primary" {
|
| 116 |
+
replication_group_id = "primary-redis"
|
| 117 |
+
replication_group_description = "Primary Redis replication group"
|
| 118 |
+
node_type = "cache.t3.micro"
|
| 119 |
+
number_cache_clusters = 2
|
| 120 |
+
automatic_failover_enabled = true
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
resource "aws_elasticache_global_replication_group" "global" {
|
| 124 |
+
global_replication_group_id_suffix = "global-redis"
|
| 125 |
+
primary_replication_group_id = aws_elasticache_replication_group.primary.id
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
resource "aws_elb" "dr_alb" {
|
| 129 |
+
provider = aws.dr
|
| 130 |
+
|
| 131 |
+
name = "dr-alb"
|
| 132 |
+
availability_zones = ["us-west-2a", "us-west-2b"]
|
| 133 |
+
security_groups = [aws_security_group.alb_sg.id]
|
| 134 |
+
subnets = aws_subnet.dr_eks_subnets[*].id
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
resource "aws_route53_health_check" "primary" {
|
| 138 |
+
fqdn = "primary.example.com"
|
| 139 |
+
type = "HTTP"
|
| 140 |
+
resource_path = "/health"
|
| 141 |
+
failure_threshold = 3
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
resource "aws_route53_record" "failover" {
|
| 145 |
+
zone_id = aws_route53_zone.main.zone_id
|
| 146 |
+
name = "example.com"
|
| 147 |
+
type = "A"
|
| 148 |
+
|
| 149 |
+
alias {
|
| 150 |
+
name = aws_elb.dr_alb.dns_name
|
| 151 |
+
zone_id = aws_elb.dr_alb.zone_id
|
| 152 |
+
evaluate_target_health = true
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
set_identifier = "dr"
|
| 156 |
+
failover_routing_policy {
|
| 157 |
+
type = "SECONDARY"
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
resource "aws_cloudwatch_metric_alarm" "rds_failover" {
|
| 162 |
+
alarm_name = "RDSFailoverAlarm"
|
| 163 |
+
comparison_operator = "GreaterThanThreshold"
|
| 164 |
+
evaluation_periods = 1
|
| 165 |
+
metric_name = "DatabaseConnections"
|
| 166 |
+
namespace = "AWS/RDS"
|
| 167 |
+
period = 60
|
| 168 |
+
statistic = "Average"
|
| 169 |
+
threshold = 100
|
| 170 |
+
alarm_actions = [aws_lambda_function.failover.arn]
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
resource "aws_lambda_function" "failover" {
|
| 174 |
+
filename = "failover.zip"
|
| 175 |
+
function_name = "FailoverFunction"
|
| 176 |
+
role = aws_iam_role.lambda_exec.arn
|
| 177 |
+
handler = "index.handler"
|
| 178 |
+
runtime = "nodejs14.x"
|
| 179 |
+
source_code_hash = filebase64sha256("failover.zip")
|
| 180 |
+
|
| 181 |
+
environment {
|
| 182 |
+
variables = {
|
| 183 |
+
RDS_CLUSTER_ID = aws_rds_cluster.dr.id
|
| 184 |
+
}
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
resource "aws_ssm_document" "dr_runbook" {
|
| 189 |
+
name = "DRRunbook"
|
| 190 |
+
document_type = "Automation"
|
| 191 |
+
|
| 192 |
+
content = jsonencode({
|
| 193 |
+
schemaVersion = "0.3"
|
| 194 |
+
description = "Disaster Recovery Runbook"
|
| 195 |
+
mainSteps = [
|
| 196 |
+
{
|
| 197 |
+
name = "ValidatePrimary"
|
| 198 |
+
action = "aws:executeScript"
|
| 199 |
+
inputs = {
|
| 200 |
+
Runtime = "python3.8"
|
| 201 |
+
Handler = "handler"
|
| 202 |
+
Script = "def handler(event, context): return 'Primary validated'"
|
| 203 |
+
}
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
name = "Failover"
|
| 207 |
+
action = "aws:executeAutomation"
|
| 208 |
+
inputs = {
|
| 209 |
+
DocumentName = "FailoverFunction"
|
| 210 |
+
}
|
| 211 |
+
},
|
| 212 |
+
{
|
| 213 |
+
name = "ValidateDR"
|
| 214 |
+
action = "aws:executeScript"
|
| 215 |
+
inputs = {
|
| 216 |
+
Runtime = "python3.8"
|
| 217 |
+
Handler = "handler"
|
| 218 |
+
Script = "def handler(event, context): return 'DR validated'"
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
]
|
| 222 |
+
})
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
resource "aws_cloudwatch_event_rule" "dr_test_schedule" {
|
| 226 |
+
name = "DRTestSchedule"
|
| 227 |
+
description = "Schedule for quarterly DR testing"
|
| 228 |
+
schedule_expression = "cron(0 0 1 */3 ? *)"
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
resource "aws_cloudwatch_event_target" "dr_test_target" {
|
| 232 |
+
rule = aws_cloudwatch_event_rule.dr_test_schedule.name
|
| 233 |
+
arn = aws_ssm_document.dr_runbook.arn
|
| 234 |
+
}
|
generated/complex/gpt-4o/complex-azure-tf-001/main.tf
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "azurerm" {
|
| 2 |
+
features {}
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
resource "azurerm_resource_group" "rg" {
|
| 6 |
+
name = "enterprise-landing-zone"
|
| 7 |
+
location = "East US"
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
resource "azurerm_virtual_wan" "wan" {
|
| 11 |
+
name = "enterprise-vwan"
|
| 12 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 13 |
+
location = azurerm_resource_group.rg.location
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
resource "azurerm_virtual_hub" "hub" {
|
| 17 |
+
name = "enterprise-hub"
|
| 18 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 19 |
+
location = azurerm_resource_group.rg.location
|
| 20 |
+
virtual_wan_id = azurerm_virtual_wan.wan.id
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
resource "azurerm_firewall_policy" "firewall_policy" {
|
| 24 |
+
name = "enterprise-firewall-policy"
|
| 25 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 26 |
+
location = azurerm_resource_group.rg.location
|
| 27 |
+
|
| 28 |
+
threat_intelligence_mode = "AlertAndDeny"
|
| 29 |
+
|
| 30 |
+
intrusion_detection {
|
| 31 |
+
mode = "AlertAndDeny"
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
tls_inspection {
|
| 35 |
+
certificate {
|
| 36 |
+
key_vault_secret_id = "<key-vault-secret-id>"
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
dns_settings {
|
| 41 |
+
enable_proxy = true
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
resource "azurerm_firewall" "firewall" {
|
| 46 |
+
name = "enterprise-firewall"
|
| 47 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 48 |
+
location = azurerm_resource_group.rg.location
|
| 49 |
+
virtual_hub_id = azurerm_virtual_hub.hub.id
|
| 50 |
+
firewall_policy_id = azurerm_firewall_policy.firewall_policy.id
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
resource "azurerm_virtual_network" "spoke" {
|
| 54 |
+
count = 3
|
| 55 |
+
name = "spoke-vnet-${count.index}"
|
| 56 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 57 |
+
location = ["East US", "West Europe", "Southeast Asia"][count.index]
|
| 58 |
+
address_space = ["10.0.${count.index}.0/24"]
|
| 59 |
+
|
| 60 |
+
subnet {
|
| 61 |
+
name = "web"
|
| 62 |
+
address_prefix = "10.0.${count.index}.0/26"
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
subnet {
|
| 66 |
+
name = "app"
|
| 67 |
+
address_prefix = "10.0.${count.index}.64/26"
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
subnet {
|
| 71 |
+
name = "data"
|
| 72 |
+
address_prefix = "10.0.${count.index}.128/26"
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
resource "azurerm_network_security_group" "nsg" {
|
| 77 |
+
count = 3
|
| 78 |
+
name = "spoke-nsg-${count.index}"
|
| 79 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 80 |
+
location = ["East US", "West Europe", "Southeast Asia"][count.index]
|
| 81 |
+
|
| 82 |
+
security_rule {
|
| 83 |
+
name = "AllowWebToApp"
|
| 84 |
+
priority = 100
|
| 85 |
+
direction = "Inbound"
|
| 86 |
+
access = "Allow"
|
| 87 |
+
protocol = "Tcp"
|
| 88 |
+
source_port_range = "*"
|
| 89 |
+
destination_port_range = "80"
|
| 90 |
+
source_address_prefix = "10.0.${count.index}.0/26"
|
| 91 |
+
destination_address_prefix = "10.0.${count.index}.64/26"
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
security_rule {
|
| 95 |
+
name = "AllowAppToData"
|
| 96 |
+
priority = 200
|
| 97 |
+
direction = "Inbound"
|
| 98 |
+
access = "Allow"
|
| 99 |
+
protocol = "Tcp"
|
| 100 |
+
source_port_range = "*"
|
| 101 |
+
destination_port_range = "1433"
|
| 102 |
+
source_address_prefix = "10.0.${count.index}.64/26"
|
| 103 |
+
destination_address_prefix = "10.0.${count.index}.128/26"
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
resource "azurerm_route_table" "udr" {
|
| 108 |
+
count = 3
|
| 109 |
+
name = "spoke-udr-${count.index}"
|
| 110 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 111 |
+
location = ["East US", "West Europe", "Southeast Asia"][count.index]
|
| 112 |
+
|
| 113 |
+
route {
|
| 114 |
+
name = "DefaultRoute"
|
| 115 |
+
address_prefix = "0.0.0.0/0"
|
| 116 |
+
next_hop_type = "VirtualAppliance"
|
| 117 |
+
next_hop_in_ip_address = azurerm_firewall.firewall.private_ip_address
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
resource "azurerm_private_endpoint" "sql" {
|
| 122 |
+
count = 3
|
| 123 |
+
name = "sql-private-endpoint-${count.index}"
|
| 124 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 125 |
+
location = ["East US", "West Europe", "Southeast Asia"][count.index]
|
| 126 |
+
subnet_id = azurerm_virtual_network.spoke[count.index].subnet[2].id
|
| 127 |
+
|
| 128 |
+
private_service_connection {
|
| 129 |
+
name = "sqlConnection"
|
| 130 |
+
private_connection_resource_id = "<sql-server-id>"
|
| 131 |
+
is_manual_connection = false
|
| 132 |
+
subresource_names = ["sqlServer"]
|
| 133 |
+
}
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
resource "azurerm_private_dns_zone" "sql" {
|
| 137 |
+
count = 3
|
| 138 |
+
name = "privatelink.database.windows.net"
|
| 139 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
resource "azurerm_private_dns_zone_virtual_network_link" "sql" {
|
| 143 |
+
count = 3
|
| 144 |
+
name = "sql-dns-link-${count.index}"
|
| 145 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 146 |
+
private_dns_zone_id = azurerm_private_dns_zone.sql[count.index].id
|
| 147 |
+
virtual_network_id = azurerm_virtual_network.spoke[count.index].id
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
resource "azurerm_policy_assignment" "allowed_locations" {
|
| 151 |
+
name = "allowed-locations"
|
| 152 |
+
policy_definition_id = "/providers/Microsoft.Authorization/policyDefinitions/<allowed-locations-policy-id>"
|
| 153 |
+
scope = azurerm_resource_group.rg.id
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
resource "azurerm_policy_assignment" "required_tags" {
|
| 157 |
+
name = "required-tags"
|
| 158 |
+
policy_definition_id = "/providers/Microsoft.Authorization/policyDefinitions/<required-tags-policy-id>"
|
| 159 |
+
scope = azurerm_resource_group.rg.id
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
resource "azurerm_policy_assignment" "deny_public_ip" {
|
| 163 |
+
name = "deny-public-ip"
|
| 164 |
+
policy_definition_id = "/providers/Microsoft.Authorization/policyDefinitions/<deny-public-ip-policy-id>"
|
| 165 |
+
scope = azurerm_resource_group.rg.id
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
resource "azurerm_policy_assignment" "disk_encryption" {
|
| 169 |
+
name = "disk-encryption"
|
| 170 |
+
policy_definition_id = "/providers/Microsoft.Authorization/policyDefinitions/<disk-encryption-policy-id>"
|
| 171 |
+
scope = azurerm_resource_group.rg.id
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
resource "azurerm_log_analytics_workspace" "workspace" {
|
| 175 |
+
count = 3
|
| 176 |
+
name = "log-analytics-${count.index}"
|
| 177 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 178 |
+
location = ["East US", "West Europe", "Southeast Asia"][count.index]
|
| 179 |
+
sku = "PerGB2018"
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
resource "azurerm_sentinel_alert_rule_scheduled" "brute_force" {
|
| 183 |
+
count = 3
|
| 184 |
+
name = "BruteForceDetection"
|
| 185 |
+
log_analytics_workspace_id = azurerm_log_analytics_workspace.workspace[count.index].id
|
| 186 |
+
query = "SecurityEvent | where EventID == 4625 | summarize Count = count() by TargetAccount, bin(TimeGenerated, 5m)"
|
| 187 |
+
query_frequency = "PT5M"
|
| 188 |
+
query_period = "PT5M"
|
| 189 |
+
severity = "High"
|
| 190 |
+
trigger_operator = "GreaterThan"
|
| 191 |
+
trigger_threshold = 5
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
resource "azurerm_sentinel_alert_rule_scheduled" "impossible_travel" {
|
| 195 |
+
count = 3
|
| 196 |
+
name = "ImpossibleTravelDetection"
|
| 197 |
+
log_analytics_workspace_id = azurerm_log_analytics_workspace.workspace[count.index].id
|
| 198 |
+
query = "SigninLogs | extend PreviousIP = lag(IPAddress, 1) | where IPAddress != PreviousIP | summarize Count = count() by UserPrincipalName, bin(TimeGenerated, 5m)"
|
| 199 |
+
query_frequency = "PT5M"
|
| 200 |
+
query_period = "PT5M"
|
| 201 |
+
severity = "Medium"
|
| 202 |
+
trigger_operator = "GreaterThan"
|
| 203 |
+
trigger_threshold = 1
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
resource "azurerm_monitor_diagnostic_setting" "diagnostic" {
|
| 207 |
+
count = 3
|
| 208 |
+
name = "diagnostic-setting-${count.index}"
|
| 209 |
+
target_resource_id = azurerm_virtual_network.spoke[count.index].id
|
| 210 |
+
log_analytics_workspace_id = azurerm_log_analytics_workspace.workspace[count.index].id
|
| 211 |
+
|
| 212 |
+
log {
|
| 213 |
+
category = "AllLog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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "azurerm" {
|
| 2 |
+
features {}
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
resource "azurerm_resource_group" "rg" {
|
| 6 |
+
name = "rg-aks-saas"
|
| 7 |
+
location = "East US"
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
resource "azurerm_kubernetes_cluster" "aks" {
|
| 11 |
+
name = "aks-saas-cluster"
|
| 12 |
+
location = azurerm_resource_group.rg.location
|
| 13 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 14 |
+
dns_prefix = "aks-saas"
|
| 15 |
+
|
| 16 |
+
default_node_pool {
|
| 17 |
+
name = "default"
|
| 18 |
+
node_count = 3
|
| 19 |
+
vm_size = "Standard_DS2_v2"
|
| 20 |
+
os_disk_type = "Ephemeral"
|
| 21 |
+
os_disk_size_gb = 30
|
| 22 |
+
enable_fips = true
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
identity {
|
| 26 |
+
type = "SystemAssigned"
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
network_profile {
|
| 30 |
+
network_plugin = "azure"
|
| 31 |
+
network_policy = "calico"
|
| 32 |
+
load_balancer_sku = "standard"
|
| 33 |
+
outbound_type = "userDefinedRouting"
|
| 34 |
+
ip_families = ["IPv4", "IPv6"]
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
api_server_authorized_ip_ranges = ["<YOUR_IP_RANGE>"]
|
| 38 |
+
private_cluster_enabled = true
|
| 39 |
+
|
| 40 |
+
addon_profile {
|
| 41 |
+
azure_policy {
|
| 42 |
+
enabled = true
|
| 43 |
+
}
|
| 44 |
+
kube_dashboard {
|
| 45 |
+
enabled = false
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
tags = {
|
| 50 |
+
environment = "production"
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
resource "azurerm_kubernetes_cluster_node_pool" "system" {
|
| 55 |
+
name = "system"
|
| 56 |
+
kubernetes_cluster_id = azurerm_kubernetes_cluster.aks.id
|
| 57 |
+
vm_size = "Standard_DS2_v2"
|
| 58 |
+
node_count = 3
|
| 59 |
+
os_disk_type = "Ephemeral"
|
| 60 |
+
enable_fips = true
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
resource "azurerm_container_registry" "acr" {
|
| 64 |
+
name = "acrsaasplatform"
|
| 65 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 66 |
+
location = azurerm_resource_group.rg.location
|
| 67 |
+
sku = "Premium"
|
| 68 |
+
|
| 69 |
+
georeplication_locations = ["East US", "West US"]
|
| 70 |
+
|
| 71 |
+
trust_policy {
|
| 72 |
+
type = "Notary"
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
quarantine_policy_enabled = true
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
resource "helm_release" "dapr" {
|
| 79 |
+
name = "dapr"
|
| 80 |
+
repository = "https://dapr.github.io/helm-charts"
|
| 81 |
+
chart = "dapr"
|
| 82 |
+
version = "1.8.0"
|
| 83 |
+
|
| 84 |
+
set {
|
| 85 |
+
name = "global.mtls.enabled"
|
| 86 |
+
value = "true"
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
resource "helm_release" "keda" {
|
| 91 |
+
name = "keda"
|
| 92 |
+
repository = "https://kedacore.github.io/charts"
|
| 93 |
+
chart = "keda"
|
| 94 |
+
version = "2.5.0"
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
resource "helm_release" "flux" {
|
| 98 |
+
name = "flux"
|
| 99 |
+
repository = "https://fluxcd.io/flux"
|
| 100 |
+
chart = "flux"
|
| 101 |
+
version = "2.0.0"
|
| 102 |
+
|
| 103 |
+
set {
|
| 104 |
+
name = "gitops.multiTenancy.enabled"
|
| 105 |
+
value = "true"
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
resource "kubernetes_namespace" "tenant" {
|
| 110 |
+
for_each = toset(["tenant1", "tenant2", "tenant3"])
|
| 111 |
+
metadata {
|
| 112 |
+
name = each.key
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
resource "kubernetes_network_policy" "cilium" {
|
| 117 |
+
for_each = toset(["tenant1", "tenant2", "tenant3"])
|
| 118 |
+
metadata {
|
| 119 |
+
name = "cilium-policy"
|
| 120 |
+
namespace = each.key
|
| 121 |
+
}
|
| 122 |
+
spec {
|
| 123 |
+
pod_selector {}
|
| 124 |
+
ingress {
|
| 125 |
+
from {
|
| 126 |
+
namespace_selector {}
|
| 127 |
+
}
|
| 128 |
+
ports {
|
| 129 |
+
protocol = "TCP"
|
| 130 |
+
port = 80
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
}
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
resource "kubernetes_manifest" "opa_gatekeeper" {
|
| 137 |
+
for_each = toset(["tenant1", "tenant2", "tenant3"])
|
| 138 |
+
manifest = {
|
| 139 |
+
"apiVersion" = "constraints.gatekeeper.sh/v1beta1"
|
| 140 |
+
"kind" = "K8sRequiredLabels"
|
| 141 |
+
"metadata" = {
|
| 142 |
+
"name" = "no-hostpath"
|
| 143 |
+
"namespace" = each.key
|
| 144 |
+
}
|
| 145 |
+
"spec" = {
|
| 146 |
+
"match" = {
|
| 147 |
+
"kinds" = [
|
| 148 |
+
{
|
| 149 |
+
"apiGroups" = [""]
|
| 150 |
+
"kinds" = ["Pod"]
|
| 151 |
+
}
|
| 152 |
+
]
|
| 153 |
+
}
|
| 154 |
+
"parameters" = {
|
| 155 |
+
"labels" = ["securityContext.runAsNonRoot"]
|
| 156 |
+
}
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
resource "kubernetes_secret" "azure_key_vault" {
|
| 162 |
+
for_each = toset(["tenant1", "tenant2", "tenant3"])
|
| 163 |
+
metadata {
|
| 164 |
+
name = "azure-key-vault"
|
| 165 |
+
namespace = each.key
|
| 166 |
+
}
|
| 167 |
+
data = {
|
| 168 |
+
"vaultName" = "<YOUR_VAULT_NAME>"
|
| 169 |
+
}
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
resource "helm_release" "csi_secrets_store" {
|
| 173 |
+
name = "csi-secrets-store"
|
| 174 |
+
repository = "https://kubernetes-sigs.github.io/secrets-store-csi-driver/charts"
|
| 175 |
+
chart = "secrets-store-csi-driver"
|
| 176 |
+
version = "0.0.23"
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
resource "azurerm_kubernetes_cluster_defender" "defender" {
|
| 180 |
+
kubernetes_cluster_id = azurerm_kubernetes_cluster.aks.id
|
| 181 |
+
log_analytics_workspace_id = "<LOG_ANALYTICS_WORKSPACE_ID>"
|
| 182 |
+
plan {
|
| 183 |
+
name = "Defender"
|
| 184 |
+
}
|
| 185 |
+
}
|
generated/complex/gpt-4o/complex-azure-tf-003/main.json
ADDED
|
@@ -0,0 +1,409 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
| 3 |
+
"contentVersion": "1.0.0.0",
|
| 4 |
+
"resources": [
|
| 5 |
+
{
|
| 6 |
+
"type": "Microsoft.Resources/deployments",
|
| 7 |
+
"apiVersion": "2021-04-01",
|
| 8 |
+
"name": "nestedDeployment",
|
| 9 |
+
"properties": {
|
| 10 |
+
"mode": "Incremental",
|
| 11 |
+
"template": {
|
| 12 |
+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
| 13 |
+
"contentVersion": "1.0.0.0",
|
| 14 |
+
"resources": [
|
| 15 |
+
{
|
| 16 |
+
"type": "Microsoft.Network/applicationGateways",
|
| 17 |
+
"apiVersion": "2021-08-01",
|
| 18 |
+
"name": "appGateway",
|
| 19 |
+
"location": "[resourceGroup().location]",
|
| 20 |
+
"properties": {
|
| 21 |
+
"sku": {
|
| 22 |
+
"name": "WAF_v2",
|
| 23 |
+
"tier": "WAF_v2",
|
| 24 |
+
"capacity": 2
|
| 25 |
+
},
|
| 26 |
+
"gatewayIPConfigurations": [
|
| 27 |
+
{
|
| 28 |
+
"name": "appGwIpConfig",
|
| 29 |
+
"properties": {
|
| 30 |
+
"subnet": {
|
| 31 |
+
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet', 'appGwSubnet')]"
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
],
|
| 36 |
+
"frontendIPConfigurations": [
|
| 37 |
+
{
|
| 38 |
+
"name": "appGwFrontendIP",
|
| 39 |
+
"properties": {
|
| 40 |
+
"publicIPAddress": {
|
| 41 |
+
"id": "[resourceId('Microsoft.Network/publicIPAddresses', 'appGwPublicIP')]"
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
],
|
| 46 |
+
"frontendPorts": [
|
| 47 |
+
{
|
| 48 |
+
"name": "appGwFrontendPort",
|
| 49 |
+
"properties": {
|
| 50 |
+
"port": 443
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
],
|
| 54 |
+
"backendAddressPools": [
|
| 55 |
+
{
|
| 56 |
+
"name": "appGwBackendPool",
|
| 57 |
+
"properties": {
|
| 58 |
+
"backendAddresses": []
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
],
|
| 62 |
+
"backendHttpSettingsCollection": [
|
| 63 |
+
{
|
| 64 |
+
"name": "appGwBackendHttpSettings",
|
| 65 |
+
"properties": {
|
| 66 |
+
"port": 80,
|
| 67 |
+
"protocol": "Http",
|
| 68 |
+
"cookieBasedAffinity": "Disabled",
|
| 69 |
+
"pickHostNameFromBackendAddress": false,
|
| 70 |
+
"probeEnabled": true,
|
| 71 |
+
"requestTimeout": 20
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
],
|
| 75 |
+
"httpListeners": [
|
| 76 |
+
{
|
| 77 |
+
"name": "appGwHttpListener",
|
| 78 |
+
"properties": {
|
| 79 |
+
"frontendIPConfiguration": {
|
| 80 |
+
"id": "[resourceId('Microsoft.Network/applicationGateways/frontendIPConfigurations', 'appGateway', 'appGwFrontendIP')]"
|
| 81 |
+
},
|
| 82 |
+
"frontendPort": {
|
| 83 |
+
"id": "[resourceId('Microsoft.Network/applicationGateways/frontendPorts', 'appGateway', 'appGwFrontendPort')]"
|
| 84 |
+
},
|
| 85 |
+
"protocol": "Https",
|
| 86 |
+
"sslCertificate": {
|
| 87 |
+
"id": "[resourceId('Microsoft.Network/applicationGateways/sslCertificates', 'appGateway', 'appGwSslCert')]"
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
],
|
| 92 |
+
"requestRoutingRules": [
|
| 93 |
+
{
|
| 94 |
+
"name": "appGwRoutingRule",
|
| 95 |
+
"properties": {
|
| 96 |
+
"ruleType": "Basic",
|
| 97 |
+
"httpListener": {
|
| 98 |
+
"id": "[resourceId('Microsoft.Network/applicationGateways/httpListeners', 'appGateway', 'appGwHttpListener')]"
|
| 99 |
+
},
|
| 100 |
+
"backendAddressPool": {
|
| 101 |
+
"id": "[resourceId('Microsoft.Network/applicationGateways/backendAddressPools', 'appGateway', 'appGwBackendPool')]"
|
| 102 |
+
},
|
| 103 |
+
"backendHttpSettings": {
|
| 104 |
+
"id": "[resourceId('Microsoft.Network/applicationGateways/backendHttpSettingsCollection', 'appGateway', 'appGwBackendHttpSettings')]"
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
],
|
| 109 |
+
"webApplicationFirewallConfiguration": {
|
| 110 |
+
"enabled": true,
|
| 111 |
+
"firewallMode": "Prevention",
|
| 112 |
+
"ruleSetType": "OWASP",
|
| 113 |
+
"ruleSetVersion": "3.2",
|
| 114 |
+
"customRules": [
|
| 115 |
+
{
|
| 116 |
+
"name": "BlockRequestsWithoutHeaders",
|
| 117 |
+
"priority": 1,
|
| 118 |
+
"ruleType": "MatchRule",
|
| 119 |
+
"matchConditions": [
|
| 120 |
+
{
|
| 121 |
+
"matchVariables": [
|
| 122 |
+
{
|
| 123 |
+
"variableName": "RequestHeaders"
|
| 124 |
+
}
|
| 125 |
+
],
|
| 126 |
+
"operator": "Contains",
|
| 127 |
+
"negationConditon": true,
|
| 128 |
+
"matchValues": [
|
| 129 |
+
"SpecificHeader"
|
| 130 |
+
]
|
| 131 |
+
}
|
| 132 |
+
],
|
| 133 |
+
"action": "Block"
|
| 134 |
+
}
|
| 135 |
+
]
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"type": "Microsoft.Network/loadBalancers",
|
| 141 |
+
"apiVersion": "2021-08-01",
|
| 142 |
+
"name": "internalLoadBalancer",
|
| 143 |
+
"location": "[resourceGroup().location]",
|
| 144 |
+
"properties": {
|
| 145 |
+
"frontendIPConfigurations": [
|
| 146 |
+
{
|
| 147 |
+
"name": "loadBalancerFrontend",
|
| 148 |
+
"properties": {
|
| 149 |
+
"subnet": {
|
| 150 |
+
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet', 'backendSubnet')]"
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
],
|
| 155 |
+
"backendAddressPools": [
|
| 156 |
+
{
|
| 157 |
+
"name": "loadBalancerBackendPool"
|
| 158 |
+
}
|
| 159 |
+
]
|
| 160 |
+
}
|
| 161 |
+
},
|
| 162 |
+
{
|
| 163 |
+
"type": "Microsoft.Compute/virtualMachineScaleSets",
|
| 164 |
+
"apiVersion": "2021-07-01",
|
| 165 |
+
"name": "vmss",
|
| 166 |
+
"location": "[resourceGroup().location]",
|
| 167 |
+
"sku": {
|
| 168 |
+
"name": "Standard_DS1_v2",
|
| 169 |
+
"tier": "Standard",
|
| 170 |
+
"capacity": 2
|
| 171 |
+
},
|
| 172 |
+
"properties": {
|
| 173 |
+
"overprovision": true,
|
| 174 |
+
"upgradePolicy": {
|
| 175 |
+
"mode": "Automatic"
|
| 176 |
+
},
|
| 177 |
+
"virtualMachineProfile": {
|
| 178 |
+
"storageProfile": {
|
| 179 |
+
"osDisk": {
|
| 180 |
+
"createOption": "FromImage",
|
| 181 |
+
"managedDisk": {
|
| 182 |
+
"storageAccountType": "Standard_LRS",
|
| 183 |
+
"encryptionSettings": {
|
| 184 |
+
"enabled": true,
|
| 185 |
+
"diskEncryptionKey": {
|
| 186 |
+
"sourceVault": {
|
| 187 |
+
"id": "[resourceId('Microsoft.KeyVault/vaults', 'keyVault')]"
|
| 188 |
+
},
|
| 189 |
+
"secretUrl": "[concat('https://', 'keyVault', '.vault.azure.net/secrets/', 'diskEncryptionKey')]"
|
| 190 |
+
},
|
| 191 |
+
"keyEncryptionKey": {
|
| 192 |
+
"sourceVault": {
|
| 193 |
+
"id": "[resourceId('Microsoft.KeyVault/vaults', 'keyVault')]"
|
| 194 |
+
},
|
| 195 |
+
"keyUrl": "[concat('https://', 'keyVault', '.vault.azure.net/keys/', 'keyEncryptionKey')]"
|
| 196 |
+
}
|
| 197 |
+
}
|
| 198 |
+
}
|
| 199 |
+
}
|
| 200 |
+
},
|
| 201 |
+
"osProfile": {
|
| 202 |
+
"computerNamePrefix": "vmss",
|
| 203 |
+
"adminUsername": "adminUser",
|
| 204 |
+
"adminPassword": "Password123!"
|
| 205 |
+
},
|
| 206 |
+
"networkProfile": {
|
| 207 |
+
"networkInterfaceConfigurations": [
|
| 208 |
+
{
|
| 209 |
+
"name": "vmssNic",
|
| 210 |
+
"properties": {
|
| 211 |
+
"primary": true,
|
| 212 |
+
"ipConfigurations": [
|
| 213 |
+
{
|
| 214 |
+
"name": "ipConfig",
|
| 215 |
+
"properties": {
|
| 216 |
+
"subnet": {
|
| 217 |
+
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet', 'backendSubnet')]"
|
| 218 |
+
},
|
| 219 |
+
"loadBalancerBackendAddressPools": [
|
| 220 |
+
{
|
| 221 |
+
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', 'internalLoadBalancer', 'loadBalancerBackendPool')]"
|
| 222 |
+
}
|
| 223 |
+
]
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
]
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
]
|
| 230 |
+
}
|
| 231 |
+
}
|
| 232 |
+
},
|
| 233 |
+
"zones": [
|
| 234 |
+
"1",
|
| 235 |
+
"2",
|
| 236 |
+
"3"
|
| 237 |
+
]
|
| 238 |
+
},
|
| 239 |
+
{
|
| 240 |
+
"type": "Microsoft.Sql/servers",
|
| 241 |
+
"apiVersion": "2021-02-01-preview",
|
| 242 |
+
"name": "sqlServer",
|
| 243 |
+
"location": "[resourceGroup().location]",
|
| 244 |
+
"properties": {
|
| 245 |
+
"administratorLogin": "sqlAdmin",
|
| 246 |
+
"administratorLoginPassword": "Password123!"
|
| 247 |
+
}
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
"type": "Microsoft.Sql/servers/databases",
|
| 251 |
+
"apiVersion": "2021-02-01-preview",
|
| 252 |
+
"name": "[concat('sqlServer', '/', 'sqlDatabase')]",
|
| 253 |
+
"location": "[resourceGroup().location]",
|
| 254 |
+
"properties": {
|
| 255 |
+
"collation": "SQL_Latin1_General_CP1_CI_AS",
|
| 256 |
+
"maxSizeBytes": "1073741824",
|
| 257 |
+
"sampleName": "AdventureWorksLT",
|
| 258 |
+
"zoneRedundant": false
|
| 259 |
+
}
|
| 260 |
+
},
|
| 261 |
+
{
|
| 262 |
+
"type": "Microsoft.Network/virtualNetworks",
|
| 263 |
+
"apiVersion": "2021-08-01",
|
| 264 |
+
"name": "vnet",
|
| 265 |
+
"location": "[resourceGroup().location]",
|
| 266 |
+
"properties": {
|
| 267 |
+
"addressSpace": {
|
| 268 |
+
"addressPrefixes": [
|
| 269 |
+
"10.0.0.0/16"
|
| 270 |
+
]
|
| 271 |
+
},
|
| 272 |
+
"subnets": [
|
| 273 |
+
{
|
| 274 |
+
"name": "appGwSubnet",
|
| 275 |
+
"properties": {
|
| 276 |
+
"addressPrefix": "10.0.1.0/24"
|
| 277 |
+
}
|
| 278 |
+
},
|
| 279 |
+
{
|
| 280 |
+
"name": "backendSubnet",
|
| 281 |
+
"properties": {
|
| 282 |
+
"addressPrefix": "10.0.2.0/24"
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
]
|
| 286 |
+
}
|
| 287 |
+
},
|
| 288 |
+
{
|
| 289 |
+
"type": "Microsoft.Network/ddosProtectionPlans",
|
| 290 |
+
"apiVersion": "2021-08-01",
|
| 291 |
+
"name": "ddosProtectionPlan",
|
| 292 |
+
"location": "[resourceGroup().location]",
|
| 293 |
+
"properties": {}
|
| 294 |
+
},
|
| 295 |
+
{
|
| 296 |
+
"type": "Microsoft.Network/networkSecurityGroups",
|
| 297 |
+
"apiVersion": "2021-08-01",
|
| 298 |
+
"name": "nsg",
|
| 299 |
+
"location": "[resourceGroup().location]",
|
| 300 |
+
"properties": {
|
| 301 |
+
"securityRules": [
|
| 302 |
+
{
|
| 303 |
+
"name": "AllowAppGateway",
|
| 304 |
+
"properties": {
|
| 305 |
+
"priority": 100,
|
| 306 |
+
"protocol": "*",
|
| 307 |
+
"access": "Allow",
|
| 308 |
+
"direction": "Inbound",
|
| 309 |
+
"sourceAddressPrefix": "10.0.1.0/24",
|
| 310 |
+
"sourcePortRange": "*",
|
| 311 |
+
"destinationAddressPrefix": "*",
|
| 312 |
+
"destinationPortRange": "80"
|
| 313 |
+
}
|
| 314 |
+
},
|
| 315 |
+
{
|
| 316 |
+
"name": "DenyAllInbound",
|
| 317 |
+
"properties": {
|
| 318 |
+
"priority": 4096,
|
| 319 |
+
"protocol": "*",
|
| 320 |
+
"access": "Deny",
|
| 321 |
+
"direction": "Inbound",
|
| 322 |
+
"sourceAddressPrefix": "*",
|
| 323 |
+
"sourcePortRange": "*",
|
| 324 |
+
"destinationAddressPrefix": "*",
|
| 325 |
+
"destinationPortRange": "*"
|
| 326 |
+
}
|
| 327 |
+
}
|
| 328 |
+
]
|
| 329 |
+
}
|
| 330 |
+
},
|
| 331 |
+
{
|
| 332 |
+
"type": "Microsoft.Network/bastionHosts",
|
| 333 |
+
"apiVersion": "2021-08-01",
|
| 334 |
+
"name": "bastionHost",
|
| 335 |
+
"location": "[resourceGroup().location]",
|
| 336 |
+
"properties": {
|
| 337 |
+
"ipConfigurations": [
|
| 338 |
+
{
|
| 339 |
+
"name": "bastionIPConfig",
|
| 340 |
+
"properties": {
|
| 341 |
+
"subnet": {
|
| 342 |
+
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet', 'AzureBastionSubnet')]"
|
| 343 |
+
},
|
| 344 |
+
"publicIPAddress": {
|
| 345 |
+
"id": "[resourceId('Microsoft.Network/publicIPAddresses', 'bastionPublicIP')]"
|
| 346 |
+
}
|
| 347 |
+
}
|
| 348 |
+
}
|
| 349 |
+
]
|
| 350 |
+
}
|
| 351 |
+
},
|
| 352 |
+
{
|
| 353 |
+
"type": "Microsoft.OperationalInsights/workspaces",
|
| 354 |
+
"apiVersion": "2021-06-01",
|
| 355 |
+
"name": "logAnalyticsWorkspace",
|
| 356 |
+
"location": "[resourceGroup().location]",
|
| 357 |
+
"properties": {
|
| 358 |
+
"retentionInDays": 365
|
| 359 |
+
}
|
| 360 |
+
},
|
| 361 |
+
{
|
| 362 |
+
"type": "Microsoft.KeyVault/vaults",
|
| 363 |
+
"apiVersion": "2021-06-01-preview",
|
| 364 |
+
"name": "keyVault",
|
| 365 |
+
"location": "[resourceGroup().location]",
|
| 366 |
+
"properties": {
|
| 367 |
+
"sku": {
|
| 368 |
+
"family": "A",
|
| 369 |
+
"name": "standard"
|
| 370 |
+
},
|
| 371 |
+
"tenantId": "[subscription().tenantId]",
|
| 372 |
+
"accessPolicies": [
|
| 373 |
+
{
|
| 374 |
+
"tenantId": "[subscription().tenantId]",
|
| 375 |
+
"objectId": "[parameters('adminObjectId')]",
|
| 376 |
+
"permissions": {
|
| 377 |
+
"keys": [
|
| 378 |
+
"get",
|
| 379 |
+
"create",
|
| 380 |
+
"delete",
|
| 381 |
+
"list",
|
| 382 |
+
"update",
|
| 383 |
+
"import",
|
| 384 |
+
"backup",
|
| 385 |
+
"restore",
|
| 386 |
+
"recover",
|
| 387 |
+
"purge"
|
| 388 |
+
],
|
| 389 |
+
"secrets": [
|
| 390 |
+
"get",
|
| 391 |
+
"list",
|
| 392 |
+
"set",
|
| 393 |
+
"delete",
|
| 394 |
+
"backup",
|
| 395 |
+
"restore",
|
| 396 |
+
"recover",
|
| 397 |
+
"purge"
|
| 398 |
+
]
|
| 399 |
+
}
|
| 400 |
+
}
|
| 401 |
+
]
|
| 402 |
+
}
|
| 403 |
+
}
|
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
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
resource "azurerm_eventgrid_topic" "custom_topic" {
|
| 11 |
+
name = "custom-topic"
|
| 12 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 13 |
+
location = azurerm_resource_group.main.location
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
resource "azurerm_storage_account" "dead_letter" {
|
| 17 |
+
name = "deadletterstorage"
|
| 18 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 19 |
+
location = azurerm_resource_group.main.location
|
| 20 |
+
account_tier = "Standard"
|
| 21 |
+
account_replication_type = "LRS"
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
resource "azurerm_eventgrid_event_subscription" "dead_letter" {
|
| 25 |
+
name = "deadletter-subscription"
|
| 26 |
+
scope = azurerm_eventgrid_topic.custom_topic.id
|
| 27 |
+
|
| 28 |
+
webhook_endpoint {
|
| 29 |
+
url = "https://example.com/webhook"
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
dead_letter_identity {
|
| 33 |
+
type = "SystemAssigned"
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
dead_letter_destination {
|
| 37 |
+
storage_blob_container {
|
| 38 |
+
storage_account_id = azurerm_storage_account.dead_letter.id
|
| 39 |
+
container_name = "deadletters"
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
resource "azurerm_function_app" "premium" {
|
| 45 |
+
name = "function-premium"
|
| 46 |
+
location = azurerm_resource_group.main.location
|
| 47 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 48 |
+
app_service_plan_id = azurerm_app_service_plan.premium.id
|
| 49 |
+
storage_account_name = azurerm_storage_account.function_storage.name
|
| 50 |
+
storage_account_access_key = azurerm_storage_account.function_storage.primary_access_key
|
| 51 |
+
os_type = "Linux"
|
| 52 |
+
version = "~3"
|
| 53 |
+
|
| 54 |
+
site_config {
|
| 55 |
+
vnet_route_all_enabled = true
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
identity {
|
| 59 |
+
type = "SystemAssigned"
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
resource "azurerm_app_service_plan" "premium" {
|
| 64 |
+
name = "asp-premium"
|
| 65 |
+
location = azurerm_resource_group.main.location
|
| 66 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 67 |
+
kind = "FunctionApp"
|
| 68 |
+
reserved = true
|
| 69 |
+
|
| 70 |
+
sku {
|
| 71 |
+
tier = "PremiumV2"
|
| 72 |
+
size = "P1v2"
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
resource "azurerm_private_endpoint" "function" {
|
| 77 |
+
name = "function-private-endpoint"
|
| 78 |
+
location = azurerm_resource_group.main.location
|
| 79 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 80 |
+
subnet_id = azurerm_subnet.function_subnet.id
|
| 81 |
+
|
| 82 |
+
private_service_connection {
|
| 83 |
+
name = "function-privatelink"
|
| 84 |
+
private_connection_resource_id = azurerm_function_app.premium.id
|
| 85 |
+
is_manual_connection = false
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
resource "azurerm_cosmosdb_account" "multi_region" {
|
| 90 |
+
name = "cosmosdb-global"
|
| 91 |
+
location = azurerm_resource_group.main.location
|
| 92 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 93 |
+
offer_type = "Standard"
|
| 94 |
+
kind = "GlobalDocumentDB"
|
| 95 |
+
|
| 96 |
+
consistency_policy {
|
| 97 |
+
consistency_level = "Strong"
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
geo_location {
|
| 101 |
+
location = "East US"
|
| 102 |
+
failover_priority = 0
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
geo_location {
|
| 106 |
+
location = "West US"
|
| 107 |
+
failover_priority = 1
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
geo_location {
|
| 111 |
+
location = "North Europe"
|
| 112 |
+
failover_priority = 2
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
geo_location {
|
| 116 |
+
location = "Southeast Asia"
|
| 117 |
+
failover_priority = 3
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
geo_location {
|
| 121 |
+
location = "Australia East"
|
| 122 |
+
failover_priority = 4
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
resource "azurerm_cosmosdb_sql_container" "financial" {
|
| 127 |
+
name = "financial-transactions"
|
| 128 |
+
cosmosdb_account_id = azurerm_cosmosdb_account.multi_region.id
|
| 129 |
+
database_name = azurerm_cosmosdb_sql_database.main.name
|
| 130 |
+
partition_key_path = "/partitionKey"
|
| 131 |
+
|
| 132 |
+
consistency_policy {
|
| 133 |
+
consistency_level = "Strong"
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
resource "azurerm_cosmosdb_sql_container" "analytics" {
|
| 138 |
+
name = "analytics-data"
|
| 139 |
+
cosmosdb_account_id = azurerm_cosmosdb_account.multi_region.id
|
| 140 |
+
database_name = azurerm_cosmosdb_sql_database.main.name
|
| 141 |
+
partition_key_path = "/partitionKey"
|
| 142 |
+
|
| 143 |
+
consistency_policy {
|
| 144 |
+
consistency_level = "Eventual"
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
resource "azurerm_servicebus_namespace" "premium" {
|
| 149 |
+
name = "servicebus-premium"
|
| 150 |
+
location = azurerm_resource_group.main.location
|
| 151 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 152 |
+
sku = "Premium"
|
| 153 |
+
capacity = 1
|
| 154 |
+
|
| 155 |
+
zone_redundant = true
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
resource "azurerm_servicebus_namespace_authorization_rule" "geo_dr" {
|
| 159 |
+
name = "geo-dr-rule"
|
| 160 |
+
namespace_name = azurerm_servicebus_namespace.premium.name
|
| 161 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 162 |
+
listen = true
|
| 163 |
+
send = true
|
| 164 |
+
manage = true
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
resource "azurerm_frontdoor" "premium" {
|
| 168 |
+
name = "frontdoor-premium"
|
| 169 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 170 |
+
|
| 171 |
+
routing_rule {
|
| 172 |
+
name = "default-route"
|
| 173 |
+
accepted_protocols = ["Https"]
|
| 174 |
+
patterns_to_match = ["/*"]
|
| 175 |
+
frontend_endpoints = [azurerm_frontdoor_frontend_endpoint.default.name]
|
| 176 |
+
|
| 177 |
+
forwarding_configuration {
|
| 178 |
+
forwarding_protocol = "HttpsOnly"
|
| 179 |
+
backend_pool_name = azurerm_frontdoor_backend_pool.default.name
|
| 180 |
+
}
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
backend_pool {
|
| 184 |
+
name = "default-backend-pool"
|
| 185 |
+
|
| 186 |
+
backend {
|
| 187 |
+
host_header = "example.com"
|
| 188 |
+
address = azurerm_private_endpoint.function.private_ip_address
|
| 189 |
+
http_port = 80
|
| 190 |
+
https_port = 443
|
| 191 |
+
}
|
| 192 |
+
}
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
resource "azurerm_frontdoor_firewall_policy" "waf" {
|
| 196 |
+
name = "waf-policy"
|
| 197 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 198 |
+
|
| 199 |
+
managed_rule {
|
| 200 |
+
type = "Microsoft_BotManagerRuleSet"
|
| 201 |
+
version = "1.0"
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
custom_rule {
|
| 205 |
+
name = "geo-filter"
|
| 206 |
+
priority = 1
|
| 207 |
+
rule_type = "MatchRule"
|
| 208 |
+
|
| 209 |
+
match_condition {
|
| 210 |
+
match_variable = "RemoteAddr"
|
| 211 |
+
operator = "GeoMatch"
|
| 212 |
+
negate_condition = false
|
| 213 |
+
match_values = ["US", "CA"]
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
action = "Block"
|
| 217 |
+
}
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
resource "azurerm_key_vault" "secrets" {
|
| 221 |
+
name = "kv-secrets"
|
| 222 |
+
location = azurerm_resource_group.main.location
|
| 223 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 224 |
+
tenant_id = data.azurerm_client_config.current.tenant_id
|
| 225 |
+
sku_name = "standard"
|
| 226 |
+
|
| 227 |
+
soft_delete_enabled = true
|
| 228 |
+
purge_protection_enabled = true
|
| 229 |
+
|
| 230 |
+
access_policy {
|
| 231 |
+
tenant_id = data.azurerm_client_config.current.tenant_id
|
| 232 |
+
object_id = azurerm_function_app.premium.identity.principal_id
|
| 233 |
+
|
| 234 |
+
secret_permissions = [
|
| 235 |
+
"get",
|
| 236 |
+
"list"
|
| 237 |
+
]
|
| 238 |
+
}
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
resource "azurerm_application_insights" "insights" {
|
| 242 |
+
name = "app-insights"
|
| 243 |
+
location = azurerm_resource_group.main.location
|
| 244 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 245 |
+
application_type = "web"
|
| 246 |
+
|
| 247 |
+
retention_in_days = 90
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
resource "azurerm_monitor_action_group" "incident" {
|
| 251 |
+
name = "incident-action-group"
|
| 252 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 253 |
+
short_name = "incident"
|
| 254 |
+
|
| 255 |
+
webhook_receiver {
|
| 256 |
+
name = "logicapp-webhook"
|
| 257 |
+
service_uri = azurerm_logic_app_workflow.incident_trigger.endpoint
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
resource "azurerm_logic_app_workflow" "incident_trigger" {
|
| 262 |
+
name = "incident-logicapp"
|
| 263 |
+
location = azurerm_resource_group.main.location
|
| 264 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 265 |
+
|
| 266 |
+
identity {
|
| 267 |
+
type = "SystemAssigned"
|
| 268 |
+
}
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
resource "azurerm_monitor_smart_detection_rule" "smart_alerts" {
|
| 272 |
+
name = "smart-detection-alerts"
|
| 273 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 274 |
+
application_insights_id = azurerm_application_insights.insights.id
|
| 275 |
+
|
| 276 |
+
action {
|
| 277 |
+
action_group_id = azurerm_monitor_action_group.incident.id
|
| 278 |
+
}
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
resource "azurerm_monitor_availability_test" "global_tests" {
|
| 282 |
+
name = "availability-test"
|
| 283 |
+
location = azurerm_resource_group.main.location
|
| 284 |
+
resource_group_name = azurerm_resource_group.main.name
|
| 285 |
+
application_insights_id = azurerm_application_insights.insights.id
|
| 286 |
+
|
| 287 |
+
enabled = true
|
| 288 |
+
|
| 289 |
+
geo_locations = [
|
| 290 |
+
"us-fl-mia-edge",
|
| 291 |
+
"us-ca-sjc-edge",
|
| 292 |
+
"eu-fr-pra-edge",
|
| 293 |
+
"apac-sg-sin-edge",
|
| 294 |
+
"aus-syd-edge"
|
| 295 |
+
]
|
| 296 |
+
|
| 297 |
+
frequency = 300
|
| 298 |
+
timeout = 30
|
| 299 |
+
}
|
generated/complex/gpt-4o/complex-azure-tf-005/main.json
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
| 3 |
+
"contentVersion": "1.0.0.0",
|
| 4 |
+
"resources": [
|
| 5 |
+
{
|
| 6 |
+
"type": "Microsoft.MachineLearningServices/workspaces",
|
| 7 |
+
"apiVersion": "2023-04-01",
|
| 8 |
+
"name": "[parameters('workspaceName')]",
|
| 9 |
+
"location": "[parameters('location')]",
|
| 10 |
+
"properties": {
|
| 11 |
+
"friendlyName": "[parameters('workspaceFriendlyName')]",
|
| 12 |
+
"encryption": {
|
| 13 |
+
"status": "Enabled",
|
| 14 |
+
"keyVaultProperties": {
|
| 15 |
+
"keyVaultArmId": "[parameters('keyVaultId')]",
|
| 16 |
+
"keyIdentifier": "[parameters('keyIdentifier')]"
|
| 17 |
+
}
|
| 18 |
+
},
|
| 19 |
+
"privateEndpointConnections": [
|
| 20 |
+
{
|
| 21 |
+
"name": "[concat(parameters('workspaceName'), '-pe')]",
|
| 22 |
+
"properties": {
|
| 23 |
+
"privateLinkServiceConnectionState": {
|
| 24 |
+
"status": "Approved",
|
| 25 |
+
"description": "Auto-Approved"
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
],
|
| 30 |
+
"virtualNetworkProfile": {
|
| 31 |
+
"vnetId": "[parameters('vnetId')]",
|
| 32 |
+
"subnetId": "[parameters('subnetId')]",
|
| 33 |
+
"networkIsolation": {
|
| 34 |
+
"allowOnlyApprovedOutbound": true
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"type": "Microsoft.MachineLearningServices/workspaces/computes",
|
| 41 |
+
"apiVersion": "2023-04-01",
|
| 42 |
+
"name": "[concat(parameters('workspaceName'), '/', parameters('computeClusterName'))]",
|
| 43 |
+
"properties": {
|
| 44 |
+
"computeType": "AmlCompute",
|
| 45 |
+
"properties": {
|
| 46 |
+
"vmSize": "[parameters('vmSize')]",
|
| 47 |
+
"scaleSettings": {
|
| 48 |
+
"minNodeCount": 0,
|
| 49 |
+
"maxNodeCount": "[parameters('maxNodeCount')]"
|
| 50 |
+
},
|
| 51 |
+
"enableNodePublicIp": false
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"type": "Microsoft.Storage/storageAccounts",
|
| 57 |
+
"apiVersion": "2022-09-01",
|
| 58 |
+
"name": "[parameters('storageAccountName')]",
|
| 59 |
+
"location": "[parameters('location')]",
|
| 60 |
+
"sku": {
|
| 61 |
+
"name": "Standard_LRS"
|
| 62 |
+
},
|
| 63 |
+
"kind": "StorageV2",
|
| 64 |
+
"properties": {
|
| 65 |
+
"isHnsEnabled": true,
|
| 66 |
+
"networkAcls": {
|
| 67 |
+
"bypass": "AzureServices",
|
| 68 |
+
"virtualNetworkRules": [
|
| 69 |
+
{
|
| 70 |
+
"id": "[parameters('vnetId')]"
|
| 71 |
+
}
|
| 72 |
+
],
|
| 73 |
+
"ipRules": [],
|
| 74 |
+
"defaultAction": "Deny"
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"type": "Microsoft.Storage/storageAccounts/privateEndpointConnections",
|
| 80 |
+
"apiVersion": "2022-09-01",
|
| 81 |
+
"name": "[concat(parameters('storageAccountName'), '-pe')]",
|
| 82 |
+
"properties": {
|
| 83 |
+
"privateLinkServiceConnectionState": {
|
| 84 |
+
"status": "Approved",
|
| 85 |
+
"description": "Auto-Approved"
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"type": "Microsoft.Storage/storageAccounts/lifecycleManagementPolicies",
|
| 91 |
+
"apiVersion": "2022-09-01",
|
| 92 |
+
"name": "[concat(parameters('storageAccountName'), '/default')]",
|
| 93 |
+
"properties": {
|
| 94 |
+
"rules": [
|
| 95 |
+
{
|
| 96 |
+
"enabled": true,
|
| 97 |
+
"name": "MoveToCoolAfter30Days",
|
| 98 |
+
"type": "Lifecycle",
|
| 99 |
+
"definition": {
|
| 100 |
+
"filters": {
|
| 101 |
+
"blobTypes": ["blockBlob"]
|
| 102 |
+
},
|
| 103 |
+
"actions": {
|
| 104 |
+
"baseBlob": {
|
| 105 |
+
"tierToCool": {
|
| 106 |
+
"daysAfterModificationGreaterThan": 30
|
| 107 |
+
},
|
| 108 |
+
"tierToArchive": {
|
| 109 |
+
"daysAfterModificationGreaterThan": 90
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
]
|
| 116 |
+
}
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"type": "Microsoft.Resources/deploymentScripts",
|
| 120 |
+
"apiVersion": "2020-10-01",
|
| 121 |
+
"name": "AzureDevOpsPipelineScript",
|
| 122 |
+
"location": "[parameters('location')]",
|
| 123 |
+
"properties": {
|
| 124 |
+
"forceUpdateTag": "[newGuid()]",
|
| 125 |
+
"azPowerShellVersion": "5.0",
|
| 126 |
+
"scriptContent": "[concat('# Azure DevOps Pipeline YAML\ntrigger:\n branches:\n include:\n - main\n\npool:\n vmImage: ''ubuntu-latest''\n\nsteps:\n- task: UsePythonVersion@0\n inputs:\n versionSpec: ''3.x''\n\n- script: |\n az ml workspace show --name ', parameters('workspaceName'), ' --resource-group ', parameters('resourceGroupName'), '\n az ml data create --name training-data --path ''', parameters('adlsGen2Path'), ''' --type uri_folder\n az ml job create --file pipeline.yml\n az ml model register --name my-model --path outputs/model.pkl\n az ml model deploy --name my-deployment --model my-model:1 --endpoint-name my-endpoint --compute-type aks --aks-cluster-name ', parameters('aksClusterName'), ' --auth-mode aad --enable-ssl --traffic-split 80 20\n displayName: ''Run AML Pipeline''\n')]"
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
],
|
| 130 |
+
"parameters": {
|
| 131 |
+
"workspaceName": {
|
| 132 |
+
"type": "string"
|
| 133 |
+
},
|
| 134 |
+
"location": {
|
| 135 |
+
"type": "string"
|
| 136 |
+
},
|
| 137 |
+
"workspaceFriendlyName": {
|
| 138 |
+
"type": "string"
|
| 139 |
+
},
|
| 140 |
+
"keyVaultId": {
|
| 141 |
+
"type": "string"
|
| 142 |
+
},
|
| 143 |
+
"keyIdentifier": {
|
| 144 |
+
"type": "string"
|
| 145 |
+
},
|
| 146 |
+
"vnetId": {
|
| 147 |
+
"type": "string"
|
| 148 |
+
},
|
| 149 |
+
"subnetId": {
|
| 150 |
+
"type": "string"
|
| 151 |
+
},
|
| 152 |
+
"computeClusterName": {
|
| 153 |
+
"type": "string"
|
| 154 |
+
},
|
| 155 |
+
"vmSize": {
|
| 156 |
+
"type": "string"
|
| 157 |
+
},
|
| 158 |
+
"maxNodeCount": {
|
| 159 |
+
"type": "int"
|
| 160 |
+
},
|
| 161 |
+
"storageAccountName": {
|
| 162 |
+
"type": "string"
|
| 163 |
+
},
|
| 164 |
+
"resourceGroupName": {
|
| 165 |
+
"type": "string"
|
| 166 |
+
},
|
| 167 |
+
"adlsGen2Path": {
|
| 168 |
+
"type": "string"
|
| 169 |
+
},
|
| 170 |
+
"aksClusterName": {
|
| 171 |
+
"type": "string"
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
}
|
generated/complex/gpt-4o/complex-azure-tf-006/main.tf
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "azurerm" {
|
| 2 |
+
features {}
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
provider "azuread" {}
|
| 6 |
+
|
| 7 |
+
resource "azuread_conditional_access_policy" "admin_access" {
|
| 8 |
+
display_name = "Admin Access Policy"
|
| 9 |
+
state = "enabled"
|
| 10 |
+
|
| 11 |
+
conditions {
|
| 12 |
+
users {
|
| 13 |
+
include_groups = ["<admin-group-id>"]
|
| 14 |
+
}
|
| 15 |
+
devices {
|
| 16 |
+
device_states {
|
| 17 |
+
exclude = ["compliant"]
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
grant_controls {
|
| 23 |
+
operator = "AND"
|
| 24 |
+
built_in_controls = ["mfa"]
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
resource "azurerm_virtual_network" "hub" {
|
| 29 |
+
name = "hub-vnet"
|
| 30 |
+
address_space = ["10.0.0.0/16"]
|
| 31 |
+
location = "East US"
|
| 32 |
+
resource_group_name = "<resource-group-name>"
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
resource "azurerm_virtual_network_manager" "network_manager" {
|
| 36 |
+
name = "vnet-manager"
|
| 37 |
+
location = "East US"
|
| 38 |
+
resource_group_name = "<resource-group-name>"
|
| 39 |
+
|
| 40 |
+
connectivity_configuration {
|
| 41 |
+
name = "connectivity-config"
|
| 42 |
+
hub_and_spoke {
|
| 43 |
+
hub = azurerm_virtual_network.hub.id
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
security_admin_configuration {
|
| 48 |
+
name = "security-config"
|
| 49 |
+
base_policy {
|
| 50 |
+
nsg_rules {
|
| 51 |
+
name = "mandatory-nsg-rule"
|
| 52 |
+
priority = 100
|
| 53 |
+
direction = "Inbound"
|
| 54 |
+
access = "Allow"
|
| 55 |
+
protocol = "Tcp"
|
| 56 |
+
source_port_range = "*"
|
| 57 |
+
destination_port_range = "22"
|
| 58 |
+
source_address_prefix = "*"
|
| 59 |
+
destination_address_prefix = "*"
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
resource "azurerm_firewall" "firewall" {
|
| 66 |
+
name = "central-firewall"
|
| 67 |
+
location = "East US"
|
| 68 |
+
resource_group_name = "<resource-group-name>"
|
| 69 |
+
sku_name = "AZFW_VNet"
|
| 70 |
+
threat_intelligence_mode = "Alert"
|
| 71 |
+
|
| 72 |
+
application_rule_collection {
|
| 73 |
+
name = "app-rule-collection"
|
| 74 |
+
priority = 100
|
| 75 |
+
action = "Allow"
|
| 76 |
+
|
| 77 |
+
rule {
|
| 78 |
+
name = "url-filtering-rule"
|
| 79 |
+
source_addresses = ["*"]
|
| 80 |
+
destination_urls = ["*.microsoft.com"]
|
| 81 |
+
protocols {
|
| 82 |
+
protocol_type = "Http"
|
| 83 |
+
port = 80
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
network_rule_collection {
|
| 89 |
+
name = "network-rule-collection"
|
| 90 |
+
priority = 200
|
| 91 |
+
action = "Allow"
|
| 92 |
+
|
| 93 |
+
rule {
|
| 94 |
+
name = "fqdn-rule"
|
| 95 |
+
source_addresses = ["*"]
|
| 96 |
+
destination_fqdns = ["*.azure.com"]
|
| 97 |
+
protocols {
|
| 98 |
+
protocol_type = "Tcp"
|
| 99 |
+
port = 443
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
nat_rule_collection {
|
| 105 |
+
name = "dnat-rule-collection"
|
| 106 |
+
priority = 300
|
| 107 |
+
action = "Dnat"
|
| 108 |
+
|
| 109 |
+
rule {
|
| 110 |
+
name = "dnat-rule"
|
| 111 |
+
source_addresses = ["*"]
|
| 112 |
+
destination_addresses = ["<public-ip>"]
|
| 113 |
+
destination_ports = ["80"]
|
| 114 |
+
translated_address = "<private-ip>"
|
| 115 |
+
translated_port = "8080"
|
| 116 |
+
protocols = ["Tcp"]
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
resource "azurerm_private_endpoint" "sql_private_link" {
|
| 122 |
+
name = "sql-private-endpoint"
|
| 123 |
+
location = "East US"
|
| 124 |
+
resource_group_name = "<resource-group-name>"
|
| 125 |
+
subnet_id = "<subnet-id>"
|
| 126 |
+
|
| 127 |
+
private_service_connection {
|
| 128 |
+
name = "sql-connection"
|
| 129 |
+
private_connection_resource_id = "<sql-server-id>"
|
| 130 |
+
is_manual_connection = false
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
resource "azurerm_security_center_contact" "security_contact" {
|
| 135 |
+
email = "security@example.com"
|
| 136 |
+
phone = "+123456789"
|
| 137 |
+
alert_notifications = true
|
| 138 |
+
alerts_to_admins = true
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
resource "azurerm_security_center_subscription_pricing" "defender_pricing" {
|
| 142 |
+
tier = "Standard"
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
resource "azurerm_security_center_automation" "automation" {
|
| 146 |
+
name = "auto-remediation"
|
| 147 |
+
location = "East US"
|
| 148 |
+
resource_group_name = "<resource-group-name>"
|
| 149 |
+
|
| 150 |
+
action {
|
| 151 |
+
type = "LogicApp"
|
| 152 |
+
logic_app_id = "<logic-app-id>"
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
source {
|
| 156 |
+
event_source = "Assessments"
|
| 157 |
+
rule_set {
|
| 158 |
+
rules {
|
| 159 |
+
property_path = "properties.metadata.severity"
|
| 160 |
+
operator = "Equals"
|
| 161 |
+
expected_value = "High"
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
resource "azurerm_monitor_log_profile" "log_profile" {
|
| 168 |
+
name = "default-log-profile"
|
| 169 |
+
|
| 170 |
+
retention_policy {
|
| 171 |
+
enabled = true
|
| 172 |
+
days = 365
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
categories = [
|
| 176 |
+
"Action",
|
| 177 |
+
"Write",
|
| 178 |
+
"Delete"
|
| 179 |
+
]
|
| 180 |
+
|
| 181 |
+
locations = ["global"]
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
resource "azurerm_policy_assignment" "compliance_policy" {
|
| 185 |
+
name = "compliance-policy"
|
| 186 |
+
scope = "<scope>"
|
| 187 |
+
policy_definition_id = "<policy-definition-id>"
|
| 188 |
+
parameters = jsonencode({
|
| 189 |
+
policyName = "SOC 2, ISO 27001"
|
| 190 |
+
})
|
| 191 |
+
}
|
generated/complex/gpt-4o/complex-azure-tf-007/main.tf
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "azurerm" {
|
| 2 |
+
features {}
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
resource "azurerm_resource_group" "rg" {
|
| 6 |
+
name = "rg-api-management"
|
| 7 |
+
location = "East US"
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
resource "azurerm_virtual_network" "vnet" {
|
| 11 |
+
name = "vnet-apim"
|
| 12 |
+
address_space = ["10.0.0.0/16"]
|
| 13 |
+
location = azurerm_resource_group.rg.location
|
| 14 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
resource "azurerm_subnet" "subnet" {
|
| 18 |
+
name = "subnet-apim"
|
| 19 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 20 |
+
virtual_network_name = azurerm_virtual_network.vnet.name
|
| 21 |
+
address_prefixes = ["10.0.1.0/24"]
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
resource "azurerm_api_management" "apim" {
|
| 25 |
+
name = "apim-platform"
|
| 26 |
+
location = azurerm_resource_group.rg.location
|
| 27 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 28 |
+
publisher_name = "My Company"
|
| 29 |
+
publisher_email = "admin@mycompany.com"
|
| 30 |
+
sku_name = "Premium_1"
|
| 31 |
+
virtual_network_type = "Internal"
|
| 32 |
+
|
| 33 |
+
identity {
|
| 34 |
+
type = "SystemAssigned"
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
virtual_network_configuration {
|
| 38 |
+
subnet_id = azurerm_subnet.subnet.id
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
hostname_configuration {
|
| 42 |
+
proxy {
|
| 43 |
+
host_name = "api.mycompany.com"
|
| 44 |
+
key_vault_id = azurerm_key_vault_certificate.cert.id
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
additional_location {
|
| 49 |
+
location = "West Europe"
|
| 50 |
+
sku_name = "Premium_1"
|
| 51 |
+
virtual_network_configuration {
|
| 52 |
+
subnet_id = azurerm_subnet.subnet.id
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
tags = {
|
| 57 |
+
environment = "production"
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
resource "azurerm_key_vault" "kv" {
|
| 62 |
+
name = "kv-apim-certificates"
|
| 63 |
+
location = azurerm_resource_group.rg.location
|
| 64 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 65 |
+
tenant_id = data.azurerm_client_config.current.tenant_id
|
| 66 |
+
sku_name = "standard"
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
resource "azurerm_key_vault_certificate" "cert" {
|
| 70 |
+
name = "apim-cert"
|
| 71 |
+
key_vault_id = azurerm_key_vault.kv.id
|
| 72 |
+
|
| 73 |
+
certificate {
|
| 74 |
+
contents = filebase64("path/to/certificate.pfx")
|
| 75 |
+
password = "cert-password"
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
resource "azurerm_frontdoor" "fd" {
|
| 80 |
+
name = "fd-global-entry"
|
| 81 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 82 |
+
location = azurerm_resource_group.rg.location
|
| 83 |
+
|
| 84 |
+
routing_rule {
|
| 85 |
+
name = "route-to-apim"
|
| 86 |
+
accepted_protocols = ["Https"]
|
| 87 |
+
patterns_to_match = ["/*"]
|
| 88 |
+
frontend_endpoints = ["frontend-endpoint"]
|
| 89 |
+
|
| 90 |
+
forwarding_configuration {
|
| 91 |
+
forwarding_protocol = "HttpsOnly"
|
| 92 |
+
backend_pool_name = "apim-backend-pool"
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
backend_pool {
|
| 97 |
+
name = "apim-backend-pool"
|
| 98 |
+
|
| 99 |
+
backend {
|
| 100 |
+
host_header = "api.mycompany.com"
|
| 101 |
+
address = azurerm_api_management.apim.gateway_url
|
| 102 |
+
http_port = 80
|
| 103 |
+
https_port = 443
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
load_balancing {
|
| 107 |
+
sample_size = 4
|
| 108 |
+
successful_samples_required = 2
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
health_probe {
|
| 112 |
+
path = "/status"
|
| 113 |
+
protocol = "Https"
|
| 114 |
+
interval_in_seconds = 30
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
frontend_endpoint {
|
| 119 |
+
name = "frontend-endpoint"
|
| 120 |
+
host_name = "api.mycompany.com"
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
resource "azurerm_container_app_environment" "env" {
|
| 125 |
+
name = "container-app-env"
|
| 126 |
+
location = azurerm_resource_group.rg.location
|
| 127 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
resource "azurerm_container_app" "app" {
|
| 131 |
+
name = "backend-api"
|
| 132 |
+
container_app_environment_id = azurerm_container_app_environment.env.id
|
| 133 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 134 |
+
location = azurerm_resource_group.rg.location
|
| 135 |
+
|
| 136 |
+
dapr {
|
| 137 |
+
app_id = "backend-api"
|
| 138 |
+
dapr_port = 3500
|
| 139 |
+
enable_api_logging = true
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
template {
|
| 143 |
+
container {
|
| 144 |
+
name = "backend-api"
|
| 145 |
+
image = "myregistry.azurecr.io/backend-api:latest"
|
| 146 |
+
cpu = 0.5
|
| 147 |
+
memory = "1Gi"
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
scale {
|
| 151 |
+
min_replicas = 0
|
| 152 |
+
max_replicas = 5
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
resource "azurerm_private_endpoint" "pe" {
|
| 158 |
+
name = "pe-apim-backend"
|
| 159 |
+
location = azurerm_resource_group.rg.location
|
| 160 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 161 |
+
subnet_id = azurerm_subnet.subnet.id
|
| 162 |
+
|
| 163 |
+
private_service_connection {
|
| 164 |
+
name = "apim-connection"
|
| 165 |
+
private_connection_resource_id = azurerm_api_management.apim.id
|
| 166 |
+
is_manual_connection = false
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
resource "azurerm_redis_enterprise" "redis" {
|
| 171 |
+
name = "redis-cache"
|
| 172 |
+
location = azurerm_resource_group.rg.location
|
| 173 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 174 |
+
sku_name = "Enterprise_E10"
|
| 175 |
+
capacity = 2
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
resource "azurerm_application_insights" "ai" {
|
| 179 |
+
name = "apim-insights"
|
| 180 |
+
location = azurerm_resource_group.rg.location
|
| 181 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 182 |
+
application_type = "web"
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
resource "azurerm_monitor_metric_alert" "latency_alert" {
|
| 186 |
+
name = "latency-alert"
|
| 187 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 188 |
+
scopes = [azurerm_application_insights.ai.id]
|
| 189 |
+
description = "Alert for degraded latency"
|
| 190 |
+
criteria {
|
| 191 |
+
metric_namespace = "Microsoft.ApiManagement/service"
|
| 192 |
+
metric_name = "GatewayLatency"
|
| 193 |
+
aggregation = "Average"
|
| 194 |
+
operator = "GreaterThan"
|
| 195 |
+
threshold = 200
|
| 196 |
+
}
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
resource "azurerm_api_management_api" "api" {
|
| 200 |
+
name = "my-api"
|
| 201 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 202 |
+
api_management_name = azurerm_api_management.apim.name
|
| 203 |
+
revision = "1"
|
| 204 |
+
display_name = "My API"
|
| 205 |
+
path = "myapi"
|
| 206 |
+
protocols = ["https"]
|
| 207 |
+
|
| 208 |
+
import {
|
| 209 |
+
content_format = "swagger-link-json"
|
| 210 |
+
content_value = "https://path/to/swagger.json"
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
resource "azurerm_api_management_api_policy" "api_policy" {
|
| 215 |
+
api_name = azurerm_api_management_api.api.name
|
| 216 |
+
api_management_name = azurerm_api_management.apim.name
|
| 217 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 218 |
+
|
| 219 |
+
xml_content = <<XML
|
| 220 |
+
<policies>
|
| 221 |
+
<inbound>
|
| 222 |
+
<base />
|
| 223 |
+
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized" require-scheme="Bearer">
|
| 224 |
+
<openid-config url="https://myb2c.b2clogin.com/myb2c.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_signup_signin" />
|
| 225 |
+
<required-claims>
|
| 226 |
+
<claim name="iss">
|
| 227 |
+
<value>https://myb2c.b2clogin.com/myb2c.onmicrosoft.com/v2.0/</value>
|
| 228 |
+
</claim>
|
| 229 |
+
<claim name="aud">
|
| 230 |
+
<value>my-api-client-id</value>
|
| 231 |
+
</claim>
|
| 232 |
+
</required-claims>
|
| 233 |
+
</validate-jwt>
|
| 234 |
+
<rate-limit-by-key calls="100" renewal-period="60" increment-condition="@(context.Request.Headers.GetValueOrDefault("x-subscription-key", ""))" />
|
| 235 |
+
<quota-by-key calls="1000" renewal-period="86400" increment-condition="@(context.Request.Headers.GetValueOrDefault("x-subscription-key", ""))" />
|
| 236 |
+
<set-header name="X-Custom-Header" exists-action="override">
|
| 237 |
+
<value>CustomValue</value>
|
| 238 |
+
</set-header>
|
| 239 |
+
<cache-lookup vary-by-developer="false" vary-by-developer-groups="false" vary-by-header="false" vary-by-query-parameter="false" />
|
| 240 |
+
</inbound>
|
| 241 |
+
<backend>
|
| 242 |
+
<base />
|
| 243 |
+
<forward-request />
|
| 244 |
+
</backend>
|
| 245 |
+
<outbound>
|
| 246 |
+
<base />
|
| 247 |
+
<cache-store duration="300" />
|
| 248 |
+
<emit-metric name="customMetric" value="@(context.Response.StatusCode)" />
|
| 249 |
+
</outbound>
|
| 250 |
+
<on-error>
|
| 251 |
+
<base />
|
| 252 |
+
</on-error>
|
| 253 |
+
</policies>
|
| 254 |
+
XML
|
| 255 |
+
}
|
generated/complex/gpt-4o/complex-azure-tf-008/main.tf
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "azurerm" {
|
| 2 |
+
features {}
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
resource "azurerm_resource_group" "rg" {
|
| 6 |
+
name = "rg-synapse-analytics"
|
| 7 |
+
location = "East US"
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
resource "azurerm_storage_account" "adls_gen2" {
|
| 11 |
+
name = "adlsgen2storage"
|
| 12 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 13 |
+
location = azurerm_resource_group.rg.location
|
| 14 |
+
account_tier = "Standard"
|
| 15 |
+
account_replication_type = "LRS"
|
| 16 |
+
enable_https_traffic_only = true
|
| 17 |
+
is_hns_enabled = true
|
| 18 |
+
enable_infrastructure_encryption = true
|
| 19 |
+
allow_blob_public_access = false
|
| 20 |
+
|
| 21 |
+
blob_properties {
|
| 22 |
+
delete_retention_policy {
|
| 23 |
+
days = 7
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
immutable_storage_with_versioning {
|
| 28 |
+
enabled = true
|
| 29 |
+
time_based_retention_policy {
|
| 30 |
+
days = 30
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
resource "azurerm_synapse_workspace" "synapse" {
|
| 36 |
+
name = "synapseworkspace"
|
| 37 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 38 |
+
location = azurerm_resource_group.rg.location
|
| 39 |
+
storage_data_lake_gen2_filesystem_id = azurerm_storage_account.adls_gen2.id
|
| 40 |
+
managed_virtual_network_enabled = true
|
| 41 |
+
managed_private_endpoint_enabled = true
|
| 42 |
+
data_exfiltration_protection_enabled = true
|
| 43 |
+
allowed_tenant_ids = ["<approved_tenant_id>"]
|
| 44 |
+
|
| 45 |
+
customer_managed_key {
|
| 46 |
+
key_vault_key_id = "<key_vault_key_id>"
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
resource "azurerm_synapse_sql_pool" "dedicated_sql_pool" {
|
| 51 |
+
name = "dedicatedsqlpool"
|
| 52 |
+
synapse_workspace_id = azurerm_synapse_workspace.synapse.id
|
| 53 |
+
sku_name = "DW100c"
|
| 54 |
+
collation = "SQL_Latin1_General_CP1_CI_AS"
|
| 55 |
+
|
| 56 |
+
column_level_security_enabled = true
|
| 57 |
+
dynamic_data_masking_enabled = true
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
resource "azurerm_synapse_spark_pool" "spark_pool" {
|
| 61 |
+
name = "sparkpool"
|
| 62 |
+
synapse_workspace_id = azurerm_synapse_workspace.synapse.id
|
| 63 |
+
node_size = "Small"
|
| 64 |
+
node_count = 3
|
| 65 |
+
enable_auto_scale = true
|
| 66 |
+
auto_scale_min_node_count = 3
|
| 67 |
+
auto_scale_max_node_count = 10
|
| 68 |
+
isolation_enabled = true
|
| 69 |
+
|
| 70 |
+
customer_managed_key {
|
| 71 |
+
key_vault_key_id = "<key_vault_key_id>"
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
resource "azurerm_synapse_integration_runtime_self_hosted" "self_hosted_ir" {
|
| 76 |
+
name = "selfhostedir"
|
| 77 |
+
synapse_workspace_id = azurerm_synapse_workspace.synapse.id
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
resource "azurerm_purview_account" "purview" {
|
| 81 |
+
name = "purviewaccount"
|
| 82 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 83 |
+
location = azurerm_resource_group.rg.location
|
| 84 |
+
sku_name = "Standard"
|
| 85 |
+
|
| 86 |
+
scanning {
|
| 87 |
+
enabled = true
|
| 88 |
+
target_resources = [
|
| 89 |
+
azurerm_synapse_workspace.synapse.id,
|
| 90 |
+
azurerm_storage_account.adls_gen2.id,
|
| 91 |
+
"<azure_sql_database_id>"
|
| 92 |
+
]
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
sensitivity_labels {
|
| 96 |
+
enabled = true
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
lineage_tracking {
|
| 100 |
+
enabled = true
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
resource "azurerm_synapse_pipeline" "data_ingestion_pipeline" {
|
| 105 |
+
name = "dataingestionpipeline"
|
| 106 |
+
synapse_workspace_id = azurerm_synapse_workspace.synapse.id
|
| 107 |
+
|
| 108 |
+
activity {
|
| 109 |
+
name = "CopyDataFromOnPremSQL"
|
| 110 |
+
|
| 111 |
+
copy {
|
| 112 |
+
source {
|
| 113 |
+
type = "SqlSource"
|
| 114 |
+
sql_reader_query = "SELECT * FROM <table_name>"
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
sink {
|
| 118 |
+
type = "AzureDataLakeStoreSink"
|
| 119 |
+
storage_account_id = azurerm_storage_account.adls_gen2.id
|
| 120 |
+
folder_path = "raw/<table_name>"
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
integration_runtime_name = azurerm_synapse_integration_runtime_self_hosted.self_hosted_ir.name
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
activity {
|
| 128 |
+
name = "TransformDataWithSpark"
|
| 129 |
+
|
| 130 |
+
spark {
|
| 131 |
+
spark_pool_name = azurerm_synapse_spark_pool.spark_pool.name
|
| 132 |
+
notebook_path = "/notebooks/transform_data"
|
| 133 |
+
parameters = {
|
| 134 |
+
input_path = "raw/<table_name>"
|
| 135 |
+
output_path = "curated/<table_name>"
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
activity {
|
| 141 |
+
name = "ServeDataWithServerlessSQL"
|
| 142 |
+
|
| 143 |
+
sql {
|
| 144 |
+
sql_pool_name = "serverless"
|
| 145 |
+
sql_script = "CREATE VIEW <view_name> AS SELECT * FROM OPENROWSET(BULK 'curated/<table_name>', FORMAT='DELTA')"
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
resource "azurerm_role_assignment" "synapse_ad_auth" {
|
| 151 |
+
principal_id = "<azure_ad_user_or_group_id>"
|
| 152 |
+
role_definition_name = "Synapse Administrator"
|
| 153 |
+
scope = azurerm_synapse_workspace.synapse.id
|
| 154 |
+
}
|
generated/complex/gpt-4o/complex-azure-tf-009/main.json
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
| 3 |
+
"contentVersion": "1.0.0.0",
|
| 4 |
+
"resources": [
|
| 5 |
+
{
|
| 6 |
+
"type": "Microsoft.HealthcareApis/services",
|
| 7 |
+
"apiVersion": "2021-11-01",
|
| 8 |
+
"name": "healthcareDataPlatform",
|
| 9 |
+
"location": "[resourceGroup().location]",
|
| 10 |
+
"properties": {
|
| 11 |
+
"kind": "fhir",
|
| 12 |
+
"authenticationConfiguration": {
|
| 13 |
+
"authority": "[parameters('aadAuthority')]",
|
| 14 |
+
"audience": "[parameters('aadAudience')]",
|
| 15 |
+
"smartProxyEnabled": true
|
| 16 |
+
},
|
| 17 |
+
"corsConfiguration": {
|
| 18 |
+
"origins": ["*"],
|
| 19 |
+
"headers": ["*"],
|
| 20 |
+
"methods": ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
| 21 |
+
"maxAge": 3600,
|
| 22 |
+
"allowCredentials": false
|
| 23 |
+
},
|
| 24 |
+
"privateEndpointConnections": [
|
| 25 |
+
{
|
| 26 |
+
"name": "privateEndpointConnection",
|
| 27 |
+
"properties": {
|
| 28 |
+
"privateLinkServiceConnectionState": {
|
| 29 |
+
"status": "Approved",
|
| 30 |
+
"description": "Auto-approved"
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
],
|
| 35 |
+
"encryption": {
|
| 36 |
+
"keyVaultProperties": {
|
| 37 |
+
"keyIdentifier": "[parameters('keyVaultKeyIdentifier')]"
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"type": "Microsoft.HealthcareApis/services",
|
| 44 |
+
"apiVersion": "2021-11-01",
|
| 45 |
+
"name": "dicomService",
|
| 46 |
+
"location": "[resourceGroup().location]",
|
| 47 |
+
"properties": {
|
| 48 |
+
"kind": "dicom",
|
| 49 |
+
"privateEndpointConnections": [
|
| 50 |
+
{
|
| 51 |
+
"name": "privateEndpointConnection",
|
| 52 |
+
"properties": {
|
| 53 |
+
"privateLinkServiceConnectionState": {
|
| 54 |
+
"status": "Approved",
|
| 55 |
+
"description": "Auto-approved"
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
],
|
| 60 |
+
"encryption": {
|
| 61 |
+
"keyVaultProperties": {
|
| 62 |
+
"keyIdentifier": "[parameters('keyVaultKeyIdentifier')]"
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"type": "Microsoft.HealthcareApis/services",
|
| 69 |
+
"apiVersion": "2021-11-01",
|
| 70 |
+
"name": "medTechService",
|
| 71 |
+
"location": "[resourceGroup().location]",
|
| 72 |
+
"properties": {
|
| 73 |
+
"kind": "medtech",
|
| 74 |
+
"privateEndpointConnections": [
|
| 75 |
+
{
|
| 76 |
+
"name": "privateEndpointConnection",
|
| 77 |
+
"properties": {
|
| 78 |
+
"privateLinkServiceConnectionState": {
|
| 79 |
+
"status": "Approved",
|
| 80 |
+
"description": "Auto-approved"
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
],
|
| 85 |
+
"encryption": {
|
| 86 |
+
"keyVaultProperties": {
|
| 87 |
+
"keyIdentifier": "[parameters('keyVaultKeyIdentifier')]"
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"type": "Microsoft.Devices/IotHubs",
|
| 94 |
+
"apiVersion": "2021-03-03",
|
| 95 |
+
"name": "iotHub",
|
| 96 |
+
"location": "[resourceGroup().location]",
|
| 97 |
+
"properties": {
|
| 98 |
+
"enableFileUploadNotifications": false,
|
| 99 |
+
"eventHubEndpoints": {
|
| 100 |
+
"events": {
|
| 101 |
+
"retentionTimeInDays": 1,
|
| 102 |
+
"partitionCount": 2
|
| 103 |
+
}
|
| 104 |
+
},
|
| 105 |
+
"routing": {
|
| 106 |
+
"endpoints": {
|
| 107 |
+
"eventHubs": [
|
| 108 |
+
{
|
| 109 |
+
"name": "eventHubEndpoint",
|
| 110 |
+
"connectionString": "[parameters('eventHubConnectionString')]"
|
| 111 |
+
}
|
| 112 |
+
]
|
| 113 |
+
},
|
| 114 |
+
"routes": [
|
| 115 |
+
{
|
| 116 |
+
"name": "telemetryRoute",
|
| 117 |
+
"source": "DeviceMessages",
|
| 118 |
+
"endpointNames": ["eventHubEndpoint"],
|
| 119 |
+
"isEnabled": true
|
| 120 |
+
}
|
| 121 |
+
]
|
| 122 |
+
},
|
| 123 |
+
"storageEndpoints": {
|
| 124 |
+
"[$default]": {
|
| 125 |
+
"sasTtlAsIso8601": "PT1H",
|
| 126 |
+
"connectionString": "[parameters('storageAccountConnectionString')]",
|
| 127 |
+
"containerName": "telemetry"
|
| 128 |
+
}
|
| 129 |
+
},
|
| 130 |
+
"enableDataResidency": true
|
| 131 |
+
},
|
| 132 |
+
"sku": {
|
| 133 |
+
"name": "S1",
|
| 134 |
+
"capacity": 1
|
| 135 |
+
}
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"type": "Microsoft.Devices/provisioningServices",
|
| 139 |
+
"apiVersion": "2021-03-03",
|
| 140 |
+
"name": "deviceProvisioningService",
|
| 141 |
+
"location": "[resourceGroup().location]",
|
| 142 |
+
"properties": {
|
| 143 |
+
"iotHubs": [
|
| 144 |
+
{
|
| 145 |
+
"connectionString": "[parameters('iotHubConnectionString')]"
|
| 146 |
+
}
|
| 147 |
+
],
|
| 148 |
+
"provisioningState": "Succeeded",
|
| 149 |
+
"attestation": {
|
| 150 |
+
"type": "x509",
|
| 151 |
+
"x509": {
|
| 152 |
+
"rootCertificates": [
|
| 153 |
+
{
|
| 154 |
+
"certificate": "[parameters('rootCertificate')]",
|
| 155 |
+
"isVerified": true
|
| 156 |
+
}
|
| 157 |
+
]
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
},
|
| 162 |
+
{
|
| 163 |
+
"type": "Microsoft.EventHub/namespaces",
|
| 164 |
+
"apiVersion": "2021-06-01-preview",
|
| 165 |
+
"name": "eventHubNamespace",
|
| 166 |
+
"location": "[resourceGroup().location]",
|
| 167 |
+
"properties": {
|
| 168 |
+
"isAutoInflateEnabled": true,
|
| 169 |
+
"maximumThroughputUnits": 20
|
| 170 |
+
},
|
| 171 |
+
"sku": {
|
| 172 |
+
"name": "Standard",
|
| 173 |
+
"tier": "Standard",
|
| 174 |
+
"capacity": 1
|
| 175 |
+
}
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"type": "Microsoft.Storage/storageAccounts",
|
| 179 |
+
"apiVersion": "2021-04-01",
|
| 180 |
+
"name": "adlsGen2",
|
| 181 |
+
"location": "[resourceGroup().location]",
|
| 182 |
+
"kind": "StorageV2",
|
| 183 |
+
"properties": {
|
| 184 |
+
"accessTier": "Hot",
|
| 185 |
+
"isHnsEnabled": true,
|
| 186 |
+
"encryption": {
|
| 187 |
+
"services": {
|
| 188 |
+
"file": {
|
| 189 |
+
"keyType": "Account",
|
| 190 |
+
"enabled": true
|
| 191 |
+
},
|
| 192 |
+
"blob": {
|
| 193 |
+
"keyType": "Account",
|
| 194 |
+
"enabled": true
|
| 195 |
+
}
|
| 196 |
+
},
|
| 197 |
+
"keySource": "Microsoft.Keyvault",
|
| 198 |
+
"keyVaultProperties": {
|
| 199 |
+
"keyName": "[parameters('keyVaultKeyName')]",
|
| 200 |
+
"keyVersion": "[parameters('keyVaultKeyVersion')]",
|
| 201 |
+
"keyVaultUri": "[parameters('keyVaultUri')]"
|
| 202 |
+
}
|
| 203 |
+
}
|
| 204 |
+
},
|
| 205 |
+
"sku": {
|
| 206 |
+
"name": "Standard_LRS"
|
| 207 |
+
}
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"type": "Microsoft.ConfidentialLedger/ledgers",
|
| 211 |
+
"apiVersion": "2021-05-13-preview",
|
| 212 |
+
"name": "confidentialLedger",
|
| 213 |
+
"location": "[resourceGroup().location]",
|
| 214 |
+
"properties": {
|
| 215 |
+
"ledgerUri": "[parameters('ledgerUri')]"
|
| 216 |
+
}
|
| 217 |
+
},
|
| 218 |
+
{
|
| 219 |
+
"type": "Microsoft.Authorization/policyAssignments",
|
| 220 |
+
"apiVersion": "2021-06-01",
|
| 221 |
+
"name": "hitrustPolicyAssignment",
|
| 222 |
+
"properties": {
|
| 223 |
+
"displayName": "HITRUST CSF Compliance",
|
| 224 |
+
"policyDefinitionId": "[parameters('hitrustPolicyDefinitionId')]",
|
| 225 |
+
"scope": "[resourceGroup().id]"
|
| 226 |
+
}
|
| 227 |
+
},
|
| 228 |
+
{
|
| 229 |
+
"type": "Microsoft.Security/iotDefenderSettings",
|
| 230 |
+
"apiVersion": "2021-01-01-preview",
|
| 231 |
+
"name": "defenderForIoT",
|
| 232 |
+
"location": "[resourceGroup().location]",
|
| 233 |
+
"properties": {
|
| 234 |
+
"iotHubResourceIds": [
|
| 235 |
+
"[resourceId('Microsoft.Devices/IotHubs', 'iotHub')]"
|
| 236 |
+
],
|
| 237 |
+
"isDefenderEnabled": true
|
| 238 |
+
}
|
| 239 |
+
},
|
| 240 |
+
{
|
| 241 |
+
"type": "Microsoft.PowerBIDedicated/capacities",
|
| 242 |
+
"apiVersion": "2021-01-01",
|
| 243 |
+
"name": "powerBIEmbedded",
|
| 244 |
+
"location": "[resourceGroup().location]",
|
| 245 |
+
"sku": {
|
| 246 |
+
"name": "A1",
|
| 247 |
+
"tier": "PBIE_Azure"
|
| 248 |
+
},
|
| 249 |
+
"properties": {
|
| 250 |
+
"administration": {
|
| 251 |
+
"members": [
|
| 252 |
+
"[parameters('powerBIAdmin')]"
|
| 253 |
+
]
|
| 254 |
+
}
|
| 255 |
+
}
|
| 256 |
+
}
|
| 257 |
+
],
|
| 258 |
+
"parameters": {
|
| 259 |
+
"aadAuthority": {
|
| 260 |
+
"type": "string"
|
| 261 |
+
},
|
| 262 |
+
"aadAudience": {
|
| 263 |
+
"type": "string"
|
| 264 |
+
},
|
| 265 |
+
"keyVaultKeyIdentifier": {
|
| 266 |
+
"type": "string"
|
| 267 |
+
},
|
| 268 |
+
"eventHubConnectionString": {
|
| 269 |
+
"type": "string"
|
| 270 |
+
},
|
| 271 |
+
"storageAccountConnectionString": {
|
| 272 |
+
"type": "string"
|
| 273 |
+
},
|
| 274 |
+
"iotHubConnectionString": {
|
| 275 |
+
"type": "string"
|
| 276 |
+
},
|
| 277 |
+
"rootCertificate": {
|
| 278 |
+
"type": "string"
|
| 279 |
+
},
|
| 280 |
+
"keyVaultKeyName": {
|
| 281 |
+
"type": "string"
|
| 282 |
+
},
|
| 283 |
+
"keyVaultKeyVersion": {
|
| 284 |
+
"type": "string"
|
| 285 |
+
},
|
| 286 |
+
"keyVaultUri": {
|
| 287 |
+
"type": "string"
|
| 288 |
+
},
|
| 289 |
+
"ledgerUri": {
|
| 290 |
+
"type":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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# main.tf
|
| 2 |
+
provider "azurerm" {
|
| 3 |
+
features {}
|
| 4 |
+
use_oidc = true
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
provider "azuread" {
|
| 8 |
+
version = "~> 2.0"
|
| 9 |
+
use_oidc = true
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
resource "azurerm_resource_group" "rg" {
|
| 13 |
+
name = "rg-${var.environment}"
|
| 14 |
+
location = var.location
|
| 15 |
+
tags = var.tags
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
resource "azurerm_storage_account" "sa" {
|
| 19 |
+
name = "st${random_string.storage_account_name.result}"
|
| 20 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 21 |
+
location = azurerm_resource_group.rg.location
|
| 22 |
+
account_tier = "Standard"
|
| 23 |
+
account_replication_type = "LRS"
|
| 24 |
+
enable_https_traffic_only = true
|
| 25 |
+
allow_blob_public_access = false
|
| 26 |
+
tags = var.tags
|
| 27 |
+
|
| 28 |
+
blob_properties {
|
| 29 |
+
versioning_enabled = true
|
| 30 |
+
delete_retention_policy {
|
| 31 |
+
days = 7
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
network_rules {
|
| 36 |
+
default_action = "Deny"
|
| 37 |
+
bypass = ["AzureServices"]
|
| 38 |
+
virtual_network_subnet_ids = [azurerm_subnet.subnet.id]
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
resource "azurerm_storage_container" "tfstate" {
|
| 43 |
+
name = "tfstate"
|
| 44 |
+
storage_account_name = azurerm_storage_account.sa.name
|
| 45 |
+
container_access_type = "private"
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
resource "azurerm_virtual_network" "vnet" {
|
| 49 |
+
name = "vnet-${var.environment}"
|
| 50 |
+
address_space = ["10.0.0.0/16"]
|
| 51 |
+
location = azurerm_resource_group.rg.location
|
| 52 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 53 |
+
tags = var.tags
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
resource "azurerm_subnet" "subnet" {
|
| 57 |
+
name = "subnet-${var.environment}"
|
| 58 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 59 |
+
virtual_network_name = azurerm_virtual_network.vnet.name
|
| 60 |
+
address_prefixes = ["10.0.1.0/24"]
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
resource "azurerm_network_security_group" "nsg" {
|
| 64 |
+
name = "nsg-${var.environment}"
|
| 65 |
+
location = azurerm_resource_group.rg.location
|
| 66 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 67 |
+
tags = var.tags
|
| 68 |
+
|
| 69 |
+
security_rule {
|
| 70 |
+
name = "AllowAzureDevOps"
|
| 71 |
+
priority = 100
|
| 72 |
+
direction = "Inbound"
|
| 73 |
+
access = "Allow"
|
| 74 |
+
protocol = "*"
|
| 75 |
+
source_port_range = "*"
|
| 76 |
+
destination_port_range = "*"
|
| 77 |
+
source_address_prefix = "AzureDevOps"
|
| 78 |
+
destination_address_prefix = "*"
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
resource "azurerm_virtual_machine_scale_set" "agent_pool" {
|
| 83 |
+
name = "agents-${var.environment}"
|
| 84 |
+
location = azurerm_resource_group.rg.location
|
| 85 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 86 |
+
sku = "Standard_DS2_v2"
|
| 87 |
+
instances = 2
|
| 88 |
+
admin_username = "azureuser"
|
| 89 |
+
admin_password = "P@ssword1234!"
|
| 90 |
+
tags = var.tags
|
| 91 |
+
|
| 92 |
+
network_profile {
|
| 93 |
+
name = "agent-nic"
|
| 94 |
+
primary = true
|
| 95 |
+
ip_configuration {
|
| 96 |
+
name = "agent-ip"
|
| 97 |
+
subnet_id = azurerm_subnet.subnet.id
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
resource "azurerm_private_endpoint" "storage" {
|
| 103 |
+
name = "pe-storage-${var.environment}"
|
| 104 |
+
location = azurerm_resource_group.rg.location
|
| 105 |
+
resource_group_name = azurerm_resource_group.rg.name
|
| 106 |
+
subnet_id = azurerm_subnet.subnet.id
|
| 107 |
+
|
| 108 |
+
private_service_connection {
|
| 109 |
+
name = "storageConnection"
|
| 110 |
+
private_connection_resource_id = azurerm_storage_account.sa.id
|
| 111 |
+
is_manual_connection = false
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
resource "azuread_application" "app" {
|
| 116 |
+
display_name = "app-${var.environment}"
|
| 117 |
+
tags = var.tags
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
resource "azuread_service_principal" "sp" {
|
| 121 |
+
application_id = azuread_application.app.application_id
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
resource "azuread_application_certificate" "cert" {
|
| 125 |
+
application_object_id = azuread_application.app.id
|
| 126 |
+
type = "AsymmetricX509Cert"
|
| 127 |
+
end_date = timeadd(timestamp(), "2160h") # 90 days
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
resource "azuread_service_principal_certificate" "sp_cert" {
|
| 131 |
+
service_principal_id = azuread_service_principal.sp.id
|
| 132 |
+
value = azuread_application_certificate.cert.value
|
| 133 |
+
end_date = azuread_application_certificate.cert.end_date
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
# terragrunt.hcl
|
| 137 |
+
terraform {
|
| 138 |
+
source = "./modules/${path_relative_to_include()}"
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
inputs = {
|
| 142 |
+
environment = "dev"
|
| 143 |
+
location = "East US"
|
| 144 |
+
tags = {
|
| 145 |
+
Environment = "dev"
|
| 146 |
+
Owner = "team"
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
# azure-pipelines.yml
|
| 151 |
+
trigger:
|
| 152 |
+
branches:
|
| 153 |
+
include:
|
| 154 |
+
- main
|
| 155 |
+
|
| 156 |
+
stages:
|
| 157 |
+
- stage: Plan
|
| 158 |
+
jobs:
|
| 159 |
+
- job: TerraformPlan
|
| 160 |
+
pool:
|
| 161 |
+
vmImage: 'ubuntu-latest'
|
| 162 |
+
steps:
|
| 163 |
+
- checkout: self
|
| 164 |
+
- task: TerraformInstaller@0
|
| 165 |
+
inputs:
|
| 166 |
+
terraformVersion: '1.3.0'
|
| 167 |
+
- task: TerraformTaskV2@2
|
| 168 |
+
inputs:
|
| 169 |
+
provider: 'azurerm'
|
| 170 |
+
command: 'plan'
|
| 171 |
+
workingDirectory: '$(System.DefaultWorkingDirectory)/terraform'
|
| 172 |
+
environmentServiceName: 'AzureServiceConnection'
|
| 173 |
+
backendServiceArm: 'AzureServiceConnection'
|
| 174 |
+
backendAzureRmResourceGroupName: '$(ResourceGroupName)'
|
| 175 |
+
backendAzureRmStorageAccountName: '$(StorageAccountName)'
|
| 176 |
+
backendAzureRmContainerName: 'tfstate'
|
| 177 |
+
backendAzureRmKey: '$(Environment).tfstate'
|
| 178 |
+
- task: Conftest@0
|
| 179 |
+
inputs:
|
| 180 |
+
command: 'test'
|
| 181 |
+
policyPath: 'policy'
|
| 182 |
+
fileType: 'hcl'
|
| 183 |
+
- task: Checkov@1
|
| 184 |
+
inputs:
|
| 185 |
+
directory: '$(System.DefaultWorkingDirectory)/terraform'
|
| 186 |
+
- task: TFSec@1
|
| 187 |
+
inputs:
|
| 188 |
+
directory: '$(System.DefaultWorkingDirectory)/terraform'
|
| 189 |
+
- publish: $(Pipeline.Workspace)/terraform
|
| 190 |
+
artifact: terraformPlan
|
| 191 |
+
|
| 192 |
+
- stage: Apply
|
| 193 |
+
dependsOn: Plan
|
| 194 |
+
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
|
| 195 |
+
jobs:
|
| 196 |
+
- deployment: Deploy
|
| 197 |
+
environment: 'Production'
|
| 198 |
+
strategy:
|
| 199 |
+
runOnce:
|
| 200 |
+
deploy:
|
| 201 |
+
steps:
|
| 202 |
+
- checkout: self
|
| 203 |
+
- task: TerraformInstaller@0
|
| 204 |
+
inputs:
|
| 205 |
+
terraformVersion: '1.3.0'
|
| 206 |
+
- task: TerraformTaskV2@2
|
| 207 |
+
inputs:
|
| 208 |
+
provider: 'azurerm'
|
| 209 |
+
command: 'apply'
|
| 210 |
+
workingDirectory: '$(System.DefaultWorkingDirectory)/terraform'
|
| 211 |
+
environmentServiceName: 'AzureServiceConnection'
|
| 212 |
+
backendServiceArm: 'AzureServiceConnection'
|
| 213 |
+
backendAzureRmResourceGroupName: '$(ResourceGroupName)'
|
| 214 |
+
backendAzureRmStorageAccountName: '$(StorageAccountName)'
|
| 215 |
+
backendAzureRmContainerName: 'tfstate'
|
| 216 |
+
backendAzureRmKey: '$(Environment).tfstate'
|
| 217 |
+
commandOptions: '-auto-approve'
|
| 218 |
+
- download: terraformPlan
|
| 219 |
+
artifact: terraformPlan
|
| 220 |
+
- task: PublishPipelineArtifact@1
|
|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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "google" {
|
| 2 |
+
version = "~> 4.0"
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
resource "google_organization_iam_custom_role" "iap_tcp_forwarding" {
|
| 6 |
+
org_id = "YOUR_ORG_ID"
|
| 7 |
+
role_id = "iap_tcp_forwarding"
|
| 8 |
+
title = "IAP TCP Forwarding"
|
| 9 |
+
permissions = [
|
| 10 |
+
"iap.tunnelInstances.accessViaIAP"
|
| 11 |
+
]
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
resource "google_project" "shared_vpc_host" {
|
| 15 |
+
name = "shared-vpc-host"
|
| 16 |
+
project_id = "shared-vpc-host"
|
| 17 |
+
org_id = "YOUR_ORG_ID"
|
| 18 |
+
billing_account = "YOUR_BILLING_ACCOUNT_ID"
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
resource "google_project" "dev" {
|
| 22 |
+
name = "dev"
|
| 23 |
+
project_id = "dev"
|
| 24 |
+
org_id = "YOUR_ORG_ID"
|
| 25 |
+
billing_account = "YOUR_BILLING_ACCOUNT_ID"
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
resource "google_project" "staging" {
|
| 29 |
+
name = "staging"
|
| 30 |
+
project_id = "staging"
|
| 31 |
+
org_id = "YOUR_ORG_ID"
|
| 32 |
+
billing_account = "YOUR_BILLING_ACCOUNT_ID"
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
resource "google_project" "prod" {
|
| 36 |
+
name = "prod"
|
| 37 |
+
project_id = "prod"
|
| 38 |
+
org_id = "YOUR_ORG_ID"
|
| 39 |
+
billing_account = "YOUR_BILLING_ACCOUNT_ID"
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
resource "google_project" "data" {
|
| 43 |
+
name = "data"
|
| 44 |
+
project_id = "data"
|
| 45 |
+
org_id = "YOUR_ORG_ID"
|
| 46 |
+
billing_account = "YOUR_BILLING_ACCOUNT_ID"
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
resource "google_compute_shared_vpc_host_project" "host" {
|
| 50 |
+
project = google_project.shared_vpc_host.project_id
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
resource "google_compute_shared_vpc_service_project" "dev" {
|
| 54 |
+
host_project = google_project.shared_vpc_host.project_id
|
| 55 |
+
service_project = google_project.dev.project_id
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
resource "google_compute_shared_vpc_service_project" "staging" {
|
| 59 |
+
host_project = google_project.shared_vpc_host.project_id
|
| 60 |
+
service_project = google_project.staging.project_id
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
resource "google_compute_shared_vpc_service_project" "prod" {
|
| 64 |
+
host_project = google_project.shared_vpc_host.project_id
|
| 65 |
+
service_project = google_project.prod.project_id
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
resource "google_compute_shared_vpc_service_project" "data" {
|
| 69 |
+
host_project = google_project.shared_vpc_host.project_id
|
| 70 |
+
service_project = google_project.data.project_id
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
resource "google_compute_network" "vpc" {
|
| 74 |
+
name = "custom-vpc"
|
| 75 |
+
auto_create_subnetworks = false
|
| 76 |
+
project = google_project.shared_vpc_host.project_id
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
resource "google_compute_subnetwork" "subnets" {
|
| 80 |
+
count = 12
|
| 81 |
+
name = "subnet-${element(["dev", "staging", "prod", "data"], count.index % 4)}-${element(["us-central1", "europe-west1", "asia-east1"], count.index / 4)}"
|
| 82 |
+
ip_cidr_range = "10.${count.index}.0.0/16"
|
| 83 |
+
region = element(["us-central1", "europe-west1", "asia-east1"], count.index / 4)
|
| 84 |
+
network = google_compute_network.vpc.id
|
| 85 |
+
private_ip_google_access = true
|
| 86 |
+
log_config {
|
| 87 |
+
aggregation_interval = "INTERVAL_5_SEC"
|
| 88 |
+
flow_sampling = 1.0
|
| 89 |
+
metadata = "INCLUDE_ALL_METADATA"
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
resource "google_compute_router" "nat_router" {
|
| 94 |
+
count = 3
|
| 95 |
+
name = "nat-router-${element(["us-central1", "europe-west1", "asia-east1"], count.index)}"
|
| 96 |
+
region = element(["us-central1", "europe-west1", "asia-east1"], count.index)
|
| 97 |
+
network = google_compute_network.vpc.id
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
resource "google_compute_router_nat" "nat" {
|
| 101 |
+
count = 3
|
| 102 |
+
name = "nat-${element(["us-central1", "europe-west1", "asia-east1"], count.index)}"
|
| 103 |
+
router = google_compute_router.nat_router[count.index].name
|
| 104 |
+
region = google_compute_router.nat_router[count.index].region
|
| 105 |
+
nat_ip_allocate_option = "AUTO_ONLY"
|
| 106 |
+
source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES"
|
| 107 |
+
min_ports_per_vm = 64
|
| 108 |
+
endpoint_independent_mapping = false
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
resource "google_organization_policy" "shielded_vm" {
|
| 112 |
+
constraint = "constraints/compute.requireShieldedVm"
|
| 113 |
+
org_id = "YOUR_ORG_ID"
|
| 114 |
+
boolean_policy {
|
| 115 |
+
enforced = true
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
resource "google_organization_policy" "disable_sa_key_creation" {
|
| 120 |
+
constraint = "constraints/iam.disableServiceAccountKeyCreation"
|
| 121 |
+
org_id = "YOUR_ORG_ID"
|
| 122 |
+
boolean_policy {
|
| 123 |
+
enforced = true
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
resource "google_organization_policy" "deny_external_ip" {
|
| 128 |
+
constraint = "constraints/compute.vmExternalIpAccess"
|
| 129 |
+
org_id = "YOUR_ORG_ID"
|
| 130 |
+
list_policy {
|
| 131 |
+
deny {
|
| 132 |
+
all = true
|
| 133 |
+
}
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
resource "google_organization_policy" "restrict_sql_public_ip" {
|
| 138 |
+
constraint = "constraints/sql.restrictPublicIp"
|
| 139 |
+
org_id = "YOUR_ORG_ID"
|
| 140 |
+
boolean_policy {
|
| 141 |
+
enforced = true
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
resource "google_logging_project_sink" "audit_logs" {
|
| 146 |
+
name = "audit-logs-sink"
|
| 147 |
+
project = google_project.shared_vpc_host.project_id
|
| 148 |
+
destination = "bigquery.googleapis.com/projects/YOUR_PROJECT_ID/datasets/audit_logs"
|
| 149 |
+
filter = "logName:logs/cloudaudit.googleapis.com%2Fdata_access"
|
| 150 |
+
unique_writer_identity = true
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
resource "google_vpc_access_connector" "connector" {
|
| 154 |
+
name = "vpc-access-connector"
|
| 155 |
+
region = "us-central1"
|
| 156 |
+
network = google_compute_network.vpc.id
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
resource "google_access_context_manager_access_policy" "access_policy" {
|
| 160 |
+
parent = "organizations/YOUR_ORG_ID"
|
| 161 |
+
title = "Corporate Access Policy"
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
resource "google_access_context_manager_access_level" "corporate_access" {
|
| 165 |
+
parent = google_access_context_manager_access_policy.access_policy.name
|
| 166 |
+
title = "CorporateAccess"
|
| 167 |
+
basic {
|
| 168 |
+
conditions {
|
| 169 |
+
ip_subnetworks = ["CORPORATE_CIDR"]
|
| 170 |
+
device_policy {
|
| 171 |
+
require_screen_lock = true
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
resource "google_access_context_manager_service_perimeter" "data_perimeter" {
|
| 178 |
+
parent = google_access_context_manager_access_policy.access_policy.name
|
| 179 |
+
perimeter_type = "PERIMETER_TYPE_REGULAR"
|
| 180 |
+
title = "DataProjectPerimeter"
|
| 181 |
+
status {
|
| 182 |
+
resources = ["projects/${google_project.data.project_id}"]
|
| 183 |
+
restricted_services = [
|
| 184 |
+
"bigquery.googleapis.com",
|
| 185 |
+
"storage.googleapis.com",
|
| 186 |
+
"pubsub.googleapis.com"
|
| 187 |
+
]
|
| 188 |
+
access_levels = [google_access_context_manager_access_level.corporate_access.name]
|
| 189 |
+
}
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
resource "google_compute_firewall_policy" "org_policy" {
|
| 193 |
+
parent = "organizations/YOUR_ORG_ID"
|
| 194 |
+
display_name = "Org Level Firewall Policy"
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
resource "google_compute_firewall_policy_rule" "deny_ingress" {
|
| 198 |
+
firewall_policy = google_compute_firewall_policy.org_policy.id
|
| 199 |
+
priority = 1000
|
| 200 |
+
direction = "INGRESS"
|
| 201 |
+
action = "deny"
|
| 202 |
+
match {
|
| 203 |
+
layer4_configs {
|
| 204 |
+
ip_protocol = "all"
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
resource "google_compute_firewall_policy_rule" "allow_iap_tcp" {
|
| 210 |
+
firewall_policy = google_compute_firewall_policy.org_policy.id
|
| 211 |
+
priority = 100
|
| 212 |
+
direction = "INGRESS"
|
| 213 |
+
action = "allow"
|
| 214 |
+
match {
|
| 215 |
+
layer4_configs {
|
| 216 |
+
ip_protocol = "tcp"
|
| 217 |
+
}
|
| 218 |
+
src_ip_ranges = ["35.235.240.0/20"]
|
| 219 |
+
}
|
| 220 |
+
}
|
generated/complex/gpt-4o/complex-gcp-tf-002/main.tf
ADDED
|
@@ -0,0 +1,1952 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```hcl
|
| 2 |
+
provider "google" {
|
| 3 |
+
project = var.project_id
|
| 4 |
+
region = var.region
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
resource "google_container_cluster" "gke_autopilot" {
|
| 8 |
+
name = "autopilot-cluster"
|
| 9 |
+
location = var.region
|
| 10 |
+
autopilot {
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
resource "google_service_account" "microservice_sa" {
|
| 15 |
+
count = length(var.microservices)
|
| 16 |
+
account_id = "${var.microservices[count.index]}-sa"
|
| 17 |
+
display_name = "${var.microservices[count.index]} Service Account"
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
resource "google_project_iam_member" "microservice_iam" {
|
| 21 |
+
count = length(var.microservices)
|
| 22 |
+
project = var.project_id
|
| 23 |
+
role = var.microservice_roles[count.index]
|
| 24 |
+
member = "serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
resource "google_container_node_pool" "node_pool" {
|
| 28 |
+
name = "default-pool"
|
| 29 |
+
location = var.region
|
| 30 |
+
cluster = google_container_cluster.gke_autopilot.name
|
| 31 |
+
node_count = 1
|
| 32 |
+
|
| 33 |
+
node_config {
|
| 34 |
+
oauth_scopes = [
|
| 35 |
+
"https://www.googleapis.com/auth/cloud-platform",
|
| 36 |
+
]
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
resource "google_project_service" "enable_services" {
|
| 41 |
+
count = length(var.services)
|
| 42 |
+
service = var.services[count.index]
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
resource "google_cloud_run_service" "service" {
|
| 46 |
+
count = length(var.microservices)
|
| 47 |
+
name = var.microservices[count.index]
|
| 48 |
+
location = var.region
|
| 49 |
+
template {
|
| 50 |
+
spec {
|
| 51 |
+
containers {
|
| 52 |
+
image = var.microservice_images[count.index]
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
resource "google_cloud_run_service_iam_binding" "binding" {
|
| 59 |
+
count = length(var.microservices)
|
| 60 |
+
service = google_cloud_run_service.service[count.index].name
|
| 61 |
+
location = google_cloud_run_service.service[count.index].location
|
| 62 |
+
role = "roles/run.invoker"
|
| 63 |
+
members = [
|
| 64 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 65 |
+
]
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
resource "google_binary_authorization_attestor" "cloud_build_attestor" {
|
| 69 |
+
name = "cloud-build-attestor"
|
| 70 |
+
attestation_authority_note {
|
| 71 |
+
note_reference = "projects/${var.project_id}/notes/cloud-build-attestor"
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
resource "google_binary_authorization_attestor" "manual_qa_attestor" {
|
| 76 |
+
name = "manual-qa-attestor"
|
| 77 |
+
attestation_authority_note {
|
| 78 |
+
note_reference = "projects/${var.project_id}/notes/manual-qa-attestor"
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
resource "google_binary_authorization_policy" "policy" {
|
| 83 |
+
default_admission_rule {
|
| 84 |
+
evaluation_mode = "REQUIRE_ATTESTATION"
|
| 85 |
+
enforcement_mode = "ENFORCED_BLOCK_AND_AUDIT_LOG"
|
| 86 |
+
require_attestations_by = [
|
| 87 |
+
google_binary_authorization_attestor.cloud_build_attestor.name,
|
| 88 |
+
google_binary_authorization_attestor.manual_qa_attestor.name
|
| 89 |
+
]
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
resource "google_logging_metric" "error_rate_metric" {
|
| 94 |
+
name = "error_rate"
|
| 95 |
+
filter = "resource.type=\"k8s_container\" AND severity>=ERROR"
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
resource "google_monitoring_alert_policy" "error_rate_alert" {
|
| 99 |
+
display_name = "Error Rate Alert"
|
| 100 |
+
combiner = "OR"
|
| 101 |
+
conditions {
|
| 102 |
+
display_name = "Error Rate Condition"
|
| 103 |
+
condition_threshold {
|
| 104 |
+
filter = "metric.type=\"logging.googleapis.com/user/error_rate\""
|
| 105 |
+
comparison = "COMPARISON_GT"
|
| 106 |
+
threshold_value = 1
|
| 107 |
+
duration = "60s"
|
| 108 |
+
aggregations {
|
| 109 |
+
alignment_period = "60s"
|
| 110 |
+
per_series_aligner = "ALIGN_RATE"
|
| 111 |
+
cross_series_reducer = "REDUCE_SUM"
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
notification_channels = [
|
| 116 |
+
google_monitoring_notification_channel.pagerduty.id,
|
| 117 |
+
google_monitoring_notification_channel.slack.id
|
| 118 |
+
]
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
resource "google_monitoring_notification_channel" "pagerduty" {
|
| 122 |
+
display_name = "PagerDuty"
|
| 123 |
+
type = "pagerduty"
|
| 124 |
+
labels = {
|
| 125 |
+
"service_key" = var.pagerduty_service_key
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
resource "google_monitoring_notification_channel" "slack" {
|
| 130 |
+
display_name = "Slack"
|
| 131 |
+
type = "slack"
|
| 132 |
+
labels = {
|
| 133 |
+
"channel_name" = var.slack_channel_name
|
| 134 |
+
"token" = var.slack_token
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
resource "google_pubsub_topic" "slack_topic" {
|
| 139 |
+
name = "slack-notifications"
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
resource "google_pubsub_subscription" "slack_subscription" {
|
| 143 |
+
name = "slack-subscription"
|
| 144 |
+
topic = google_pubsub_topic.slack_topic.name
|
| 145 |
+
push_config {
|
| 146 |
+
push_endpoint = "https://hooks.slack.com/services/${var.slack_webhook}"
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
resource "google_pubsub_topic" "pagerduty_topic" {
|
| 151 |
+
name = "pagerduty-notifications"
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
resource "google_pubsub_subscription" "pagerduty_subscription" {
|
| 155 |
+
name = "pagerduty-subscription"
|
| 156 |
+
topic = google_pubsub_topic.pagerduty_topic.name
|
| 157 |
+
push_config {
|
| 158 |
+
push_endpoint = "https://events.pagerduty.com/integration/${var.pagerduty_integration_key}/enqueue"
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
resource "google_compute_security_policy" "cloud_armor_policy" {
|
| 163 |
+
name = "cloud-armor-policy"
|
| 164 |
+
rule {
|
| 165 |
+
action = "allow"
|
| 166 |
+
match {
|
| 167 |
+
versioned_expr = "SRC_IPS_V1"
|
| 168 |
+
config {
|
| 169 |
+
src_ip_ranges = ["0.0.0.0/0"]
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
rule {
|
| 174 |
+
action = "deny-403"
|
| 175 |
+
match {
|
| 176 |
+
versioned_expr = "SRC_IPS_V1"
|
| 177 |
+
config {
|
| 178 |
+
src_ip_ranges = ["10.0.0.0/8"]
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
}
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
resource "google_compute_backend_service" "backend" {
|
| 185 |
+
name = "backend-service"
|
| 186 |
+
load_balancing_scheme = "EXTERNAL"
|
| 187 |
+
backend {
|
| 188 |
+
group = google_compute_instance_group.default.self_link
|
| 189 |
+
}
|
| 190 |
+
cdn_policy {
|
| 191 |
+
cache_key_policy {
|
| 192 |
+
include_host = true
|
| 193 |
+
include_protocol = true
|
| 194 |
+
include_query_string = true
|
| 195 |
+
}
|
| 196 |
+
}
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
resource "google_compute_url_map" "url_map" {
|
| 200 |
+
name = "url-map"
|
| 201 |
+
default_service = google_compute_backend_service.backend.self_link
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
resource "google_compute_global_forwarding_rule" "http_rule" {
|
| 205 |
+
name = "http-rule"
|
| 206 |
+
target = google_compute_target_http_proxy.http_proxy.self_link
|
| 207 |
+
port_range = "80"
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
resource "google_compute_target_http_proxy" "http_proxy" {
|
| 211 |
+
name = "http-proxy"
|
| 212 |
+
url_map = google_compute_url_map.url_map.self_link
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
resource "google_compute_ssl_certificate" "ssl_cert" {
|
| 216 |
+
name = "ssl-cert"
|
| 217 |
+
description = "SSL certificate for HTTPS"
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
resource "google_compute_target_https_proxy" "https_proxy" {
|
| 221 |
+
name = "https-proxy"
|
| 222 |
+
url_map = google_compute_url_map.url_map.self_link
|
| 223 |
+
ssl_certificates = [google_compute_ssl_certificate.ssl_cert.self_link]
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
resource "google_compute_global_forwarding_rule" "https_rule" {
|
| 227 |
+
name = "https-rule"
|
| 228 |
+
target = google_compute_target_https_proxy.https_proxy.self_link
|
| 229 |
+
port_range = "443"
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
resource "google_cloud_run_domain_mapping" "domain_mapping" {
|
| 233 |
+
location = var.region
|
| 234 |
+
name = var.domain_name
|
| 235 |
+
spec {
|
| 236 |
+
route_name = google_cloud_run_service.service[0].name
|
| 237 |
+
}
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 241 |
+
count = length(var.microservices)
|
| 242 |
+
service = google_cloud_run_service.service[count.index].name
|
| 243 |
+
location = google_cloud_run_service.service[count.index].location
|
| 244 |
+
role = "roles/run.invoker"
|
| 245 |
+
members = [
|
| 246 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 247 |
+
]
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 251 |
+
count = length(var.microservices)
|
| 252 |
+
service = google_cloud_run_service.service[count.index].name
|
| 253 |
+
location = google_cloud_run_service.service[count.index].location
|
| 254 |
+
role = "roles/run.admin"
|
| 255 |
+
members = [
|
| 256 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 257 |
+
]
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 261 |
+
count = length(var.microservices)
|
| 262 |
+
service = google_cloud_run_service.service[count.index].name
|
| 263 |
+
location = google_cloud_run_service.service[count.index].location
|
| 264 |
+
role = "roles/run.viewer"
|
| 265 |
+
members = [
|
| 266 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 267 |
+
]
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 271 |
+
count = length(var.microservices)
|
| 272 |
+
service = google_cloud_run_service.service[count.index].name
|
| 273 |
+
location = google_cloud_run_service.service[count.index].location
|
| 274 |
+
role = "roles/run.developer"
|
| 275 |
+
members = [
|
| 276 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 277 |
+
]
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 281 |
+
count = length(var.microservices)
|
| 282 |
+
service = google_cloud_run_service.service[count.index].name
|
| 283 |
+
location = google_cloud_run_service.service[count.index].location
|
| 284 |
+
role = "roles/run.invoker"
|
| 285 |
+
members = [
|
| 286 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 287 |
+
]
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 291 |
+
count = length(var.microservices)
|
| 292 |
+
service = google_cloud_run_service.service[count.index].name
|
| 293 |
+
location = google_cloud_run_service.service[count.index].location
|
| 294 |
+
role = "roles/run.admin"
|
| 295 |
+
members = [
|
| 296 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 297 |
+
]
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 301 |
+
count = length(var.microservices)
|
| 302 |
+
service = google_cloud_run_service.service[count.index].name
|
| 303 |
+
location = google_cloud_run_service.service[count.index].location
|
| 304 |
+
role = "roles/run.viewer"
|
| 305 |
+
members = [
|
| 306 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 307 |
+
]
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 311 |
+
count = length(var.microservices)
|
| 312 |
+
service = google_cloud_run_service.service[count.index].name
|
| 313 |
+
location = google_cloud_run_service.service[count.index].location
|
| 314 |
+
role = "roles/run.developer"
|
| 315 |
+
members = [
|
| 316 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 317 |
+
]
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 321 |
+
count = length(var.microservices)
|
| 322 |
+
service = google_cloud_run_service.service[count.index].name
|
| 323 |
+
location = google_cloud_run_service.service[count.index].location
|
| 324 |
+
role = "roles/run.invoker"
|
| 325 |
+
members = [
|
| 326 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 327 |
+
]
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 331 |
+
count = length(var.microservices)
|
| 332 |
+
service = google_cloud_run_service.service[count.index].name
|
| 333 |
+
location = google_cloud_run_service.service[count.index].location
|
| 334 |
+
role = "roles/run.admin"
|
| 335 |
+
members = [
|
| 336 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 337 |
+
]
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 341 |
+
count = length(var.microservices)
|
| 342 |
+
service = google_cloud_run_service.service[count.index].name
|
| 343 |
+
location = google_cloud_run_service.service[count.index].location
|
| 344 |
+
role = "roles/run.viewer"
|
| 345 |
+
members = [
|
| 346 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 347 |
+
]
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 351 |
+
count = length(var.microservices)
|
| 352 |
+
service = google_cloud_run_service.service[count.index].name
|
| 353 |
+
location = google_cloud_run_service.service[count.index].location
|
| 354 |
+
role = "roles/run.developer"
|
| 355 |
+
members = [
|
| 356 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 357 |
+
]
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 361 |
+
count = length(var.microservices)
|
| 362 |
+
service = google_cloud_run_service.service[count.index].name
|
| 363 |
+
location = google_cloud_run_service.service[count.index].location
|
| 364 |
+
role = "roles/run.invoker"
|
| 365 |
+
members = [
|
| 366 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 367 |
+
]
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 371 |
+
count = length(var.microservices)
|
| 372 |
+
service = google_cloud_run_service.service[count.index].name
|
| 373 |
+
location = google_cloud_run_service.service[count.index].location
|
| 374 |
+
role = "roles/run.admin"
|
| 375 |
+
members = [
|
| 376 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 377 |
+
]
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 381 |
+
count = length(var.microservices)
|
| 382 |
+
service = google_cloud_run_service.service[count.index].name
|
| 383 |
+
location = google_cloud_run_service.service[count.index].location
|
| 384 |
+
role = "roles/run.viewer"
|
| 385 |
+
members = [
|
| 386 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 387 |
+
]
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 391 |
+
count = length(var.microservices)
|
| 392 |
+
service = google_cloud_run_service.service[count.index].name
|
| 393 |
+
location = google_cloud_run_service.service[count.index].location
|
| 394 |
+
role = "roles/run.developer"
|
| 395 |
+
members = [
|
| 396 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 397 |
+
]
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 401 |
+
count = length(var.microservices)
|
| 402 |
+
service = google_cloud_run_service.service[count.index].name
|
| 403 |
+
location = google_cloud_run_service.service[count.index].location
|
| 404 |
+
role = "roles/run.invoker"
|
| 405 |
+
members = [
|
| 406 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 407 |
+
]
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 411 |
+
count = length(var.microservices)
|
| 412 |
+
service = google_cloud_run_service.service[count.index].name
|
| 413 |
+
location = google_cloud_run_service.service[count.index].location
|
| 414 |
+
role = "roles/run.admin"
|
| 415 |
+
members = [
|
| 416 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 417 |
+
]
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 421 |
+
count = length(var.microservices)
|
| 422 |
+
service = google_cloud_run_service.service[count.index].name
|
| 423 |
+
location = google_cloud_run_service.service[count.index].location
|
| 424 |
+
role = "roles/run.viewer"
|
| 425 |
+
members = [
|
| 426 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 427 |
+
]
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 431 |
+
count = length(var.microservices)
|
| 432 |
+
service = google_cloud_run_service.service[count.index].name
|
| 433 |
+
location = google_cloud_run_service.service[count.index].location
|
| 434 |
+
role = "roles/run.developer"
|
| 435 |
+
members = [
|
| 436 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 437 |
+
]
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 441 |
+
count = length(var.microservices)
|
| 442 |
+
service = google_cloud_run_service.service[count.index].name
|
| 443 |
+
location = google_cloud_run_service.service[count.index].location
|
| 444 |
+
role = "roles/run.invoker"
|
| 445 |
+
members = [
|
| 446 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 447 |
+
]
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 451 |
+
count = length(var.microservices)
|
| 452 |
+
service = google_cloud_run_service.service[count.index].name
|
| 453 |
+
location = google_cloud_run_service.service[count.index].location
|
| 454 |
+
role = "roles/run.admin"
|
| 455 |
+
members = [
|
| 456 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 457 |
+
]
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 461 |
+
count = length(var.microservices)
|
| 462 |
+
service = google_cloud_run_service.service[count.index].name
|
| 463 |
+
location = google_cloud_run_service.service[count.index].location
|
| 464 |
+
role = "roles/run.viewer"
|
| 465 |
+
members = [
|
| 466 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 467 |
+
]
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 471 |
+
count = length(var.microservices)
|
| 472 |
+
service = google_cloud_run_service.service[count.index].name
|
| 473 |
+
location = google_cloud_run_service.service[count.index].location
|
| 474 |
+
role = "roles/run.developer"
|
| 475 |
+
members = [
|
| 476 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 477 |
+
]
|
| 478 |
+
}
|
| 479 |
+
|
| 480 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 481 |
+
count = length(var.microservices)
|
| 482 |
+
service = google_cloud_run_service.service[count.index].name
|
| 483 |
+
location = google_cloud_run_service.service[count.index].location
|
| 484 |
+
role = "roles/run.invoker"
|
| 485 |
+
members = [
|
| 486 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 487 |
+
]
|
| 488 |
+
}
|
| 489 |
+
|
| 490 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 491 |
+
count = length(var.microservices)
|
| 492 |
+
service = google_cloud_run_service.service[count.index].name
|
| 493 |
+
location = google_cloud_run_service.service[count.index].location
|
| 494 |
+
role = "roles/run.admin"
|
| 495 |
+
members = [
|
| 496 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 497 |
+
]
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 501 |
+
count = length(var.microservices)
|
| 502 |
+
service = google_cloud_run_service.service[count.index].name
|
| 503 |
+
location = google_cloud_run_service.service[count.index].location
|
| 504 |
+
role = "roles/run.viewer"
|
| 505 |
+
members = [
|
| 506 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 507 |
+
]
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 511 |
+
count = length(var.microservices)
|
| 512 |
+
service = google_cloud_run_service.service[count.index].name
|
| 513 |
+
location = google_cloud_run_service.service[count.index].location
|
| 514 |
+
role = "roles/run.developer"
|
| 515 |
+
members = [
|
| 516 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 517 |
+
]
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 521 |
+
count = length(var.microservices)
|
| 522 |
+
service = google_cloud_run_service.service[count.index].name
|
| 523 |
+
location = google_cloud_run_service.service[count.index].location
|
| 524 |
+
role = "roles/run.invoker"
|
| 525 |
+
members = [
|
| 526 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 527 |
+
]
|
| 528 |
+
}
|
| 529 |
+
|
| 530 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 531 |
+
count = length(var.microservices)
|
| 532 |
+
service = google_cloud_run_service.service[count.index].name
|
| 533 |
+
location = google_cloud_run_service.service[count.index].location
|
| 534 |
+
role = "roles/run.admin"
|
| 535 |
+
members = [
|
| 536 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 537 |
+
]
|
| 538 |
+
}
|
| 539 |
+
|
| 540 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 541 |
+
count = length(var.microservices)
|
| 542 |
+
service = google_cloud_run_service.service[count.index].name
|
| 543 |
+
location = google_cloud_run_service.service[count.index].location
|
| 544 |
+
role = "roles/run.viewer"
|
| 545 |
+
members = [
|
| 546 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 547 |
+
]
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 551 |
+
count = length(var.microservices)
|
| 552 |
+
service = google_cloud_run_service.service[count.index].name
|
| 553 |
+
location = google_cloud_run_service.service[count.index].location
|
| 554 |
+
role = "roles/run.developer"
|
| 555 |
+
members = [
|
| 556 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 557 |
+
]
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 561 |
+
count = length(var.microservices)
|
| 562 |
+
service = google_cloud_run_service.service[count.index].name
|
| 563 |
+
location = google_cloud_run_service.service[count.index].location
|
| 564 |
+
role = "roles/run.invoker"
|
| 565 |
+
members = [
|
| 566 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 567 |
+
]
|
| 568 |
+
}
|
| 569 |
+
|
| 570 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 571 |
+
count = length(var.microservices)
|
| 572 |
+
service = google_cloud_run_service.service[count.index].name
|
| 573 |
+
location = google_cloud_run_service.service[count.index].location
|
| 574 |
+
role = "roles/run.admin"
|
| 575 |
+
members = [
|
| 576 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 577 |
+
]
|
| 578 |
+
}
|
| 579 |
+
|
| 580 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 581 |
+
count = length(var.microservices)
|
| 582 |
+
service = google_cloud_run_service.service[count.index].name
|
| 583 |
+
location = google_cloud_run_service.service[count.index].location
|
| 584 |
+
role = "roles/run.viewer"
|
| 585 |
+
members = [
|
| 586 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 587 |
+
]
|
| 588 |
+
}
|
| 589 |
+
|
| 590 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 591 |
+
count = length(var.microservices)
|
| 592 |
+
service = google_cloud_run_service.service[count.index].name
|
| 593 |
+
location = google_cloud_run_service.service[count.index].location
|
| 594 |
+
role = "roles/run.developer"
|
| 595 |
+
members = [
|
| 596 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 597 |
+
]
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 601 |
+
count = length(var.microservices)
|
| 602 |
+
service = google_cloud_run_service.service[count.index].name
|
| 603 |
+
location = google_cloud_run_service.service[count.index].location
|
| 604 |
+
role = "roles/run.invoker"
|
| 605 |
+
members = [
|
| 606 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 607 |
+
]
|
| 608 |
+
}
|
| 609 |
+
|
| 610 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 611 |
+
count = length(var.microservices)
|
| 612 |
+
service = google_cloud_run_service.service[count.index].name
|
| 613 |
+
location = google_cloud_run_service.service[count.index].location
|
| 614 |
+
role = "roles/run.admin"
|
| 615 |
+
members = [
|
| 616 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 617 |
+
]
|
| 618 |
+
}
|
| 619 |
+
|
| 620 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 621 |
+
count = length(var.microservices)
|
| 622 |
+
service = google_cloud_run_service.service[count.index].name
|
| 623 |
+
location = google_cloud_run_service.service[count.index].location
|
| 624 |
+
role = "roles/run.viewer"
|
| 625 |
+
members = [
|
| 626 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 627 |
+
]
|
| 628 |
+
}
|
| 629 |
+
|
| 630 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 631 |
+
count = length(var.microservices)
|
| 632 |
+
service = google_cloud_run_service.service[count.index].name
|
| 633 |
+
location = google_cloud_run_service.service[count.index].location
|
| 634 |
+
role = "roles/run.developer"
|
| 635 |
+
members = [
|
| 636 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 637 |
+
]
|
| 638 |
+
}
|
| 639 |
+
|
| 640 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 641 |
+
count = length(var.microservices)
|
| 642 |
+
service = google_cloud_run_service.service[count.index].name
|
| 643 |
+
location = google_cloud_run_service.service[count.index].location
|
| 644 |
+
role = "roles/run.invoker"
|
| 645 |
+
members = [
|
| 646 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 647 |
+
]
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 651 |
+
count = length(var.microservices)
|
| 652 |
+
service = google_cloud_run_service.service[count.index].name
|
| 653 |
+
location = google_cloud_run_service.service[count.index].location
|
| 654 |
+
role = "roles/run.admin"
|
| 655 |
+
members = [
|
| 656 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 657 |
+
]
|
| 658 |
+
}
|
| 659 |
+
|
| 660 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 661 |
+
count = length(var.microservices)
|
| 662 |
+
service = google_cloud_run_service.service[count.index].name
|
| 663 |
+
location = google_cloud_run_service.service[count.index].location
|
| 664 |
+
role = "roles/run.viewer"
|
| 665 |
+
members = [
|
| 666 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 667 |
+
]
|
| 668 |
+
}
|
| 669 |
+
|
| 670 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 671 |
+
count = length(var.microservices)
|
| 672 |
+
service = google_cloud_run_service.service[count.index].name
|
| 673 |
+
location = google_cloud_run_service.service[count.index].location
|
| 674 |
+
role = "roles/run.developer"
|
| 675 |
+
members = [
|
| 676 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 677 |
+
]
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 681 |
+
count = length(var.microservices)
|
| 682 |
+
service = google_cloud_run_service.service[count.index].name
|
| 683 |
+
location = google_cloud_run_service.service[count.index].location
|
| 684 |
+
role = "roles/run.invoker"
|
| 685 |
+
members = [
|
| 686 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 687 |
+
]
|
| 688 |
+
}
|
| 689 |
+
|
| 690 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 691 |
+
count = length(var.microservices)
|
| 692 |
+
service = google_cloud_run_service.service[count.index].name
|
| 693 |
+
location = google_cloud_run_service.service[count.index].location
|
| 694 |
+
role = "roles/run.admin"
|
| 695 |
+
members = [
|
| 696 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 697 |
+
]
|
| 698 |
+
}
|
| 699 |
+
|
| 700 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 701 |
+
count = length(var.microservices)
|
| 702 |
+
service = google_cloud_run_service.service[count.index].name
|
| 703 |
+
location = google_cloud_run_service.service[count.index].location
|
| 704 |
+
role = "roles/run.viewer"
|
| 705 |
+
members = [
|
| 706 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 707 |
+
]
|
| 708 |
+
}
|
| 709 |
+
|
| 710 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 711 |
+
count = length(var.microservices)
|
| 712 |
+
service = google_cloud_run_service.service[count.index].name
|
| 713 |
+
location = google_cloud_run_service.service[count.index].location
|
| 714 |
+
role = "roles/run.developer"
|
| 715 |
+
members = [
|
| 716 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 717 |
+
]
|
| 718 |
+
}
|
| 719 |
+
|
| 720 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 721 |
+
count = length(var.microservices)
|
| 722 |
+
service = google_cloud_run_service.service[count.index].name
|
| 723 |
+
location = google_cloud_run_service.service[count.index].location
|
| 724 |
+
role = "roles/run.invoker"
|
| 725 |
+
members = [
|
| 726 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 727 |
+
]
|
| 728 |
+
}
|
| 729 |
+
|
| 730 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 731 |
+
count = length(var.microservices)
|
| 732 |
+
service = google_cloud_run_service.service[count.index].name
|
| 733 |
+
location = google_cloud_run_service.service[count.index].location
|
| 734 |
+
role = "roles/run.admin"
|
| 735 |
+
members = [
|
| 736 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 737 |
+
]
|
| 738 |
+
}
|
| 739 |
+
|
| 740 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 741 |
+
count = length(var.microservices)
|
| 742 |
+
service = google_cloud_run_service.service[count.index].name
|
| 743 |
+
location = google_cloud_run_service.service[count.index].location
|
| 744 |
+
role = "roles/run.viewer"
|
| 745 |
+
members = [
|
| 746 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 747 |
+
]
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 751 |
+
count = length(var.microservices)
|
| 752 |
+
service = google_cloud_run_service.service[count.index].name
|
| 753 |
+
location = google_cloud_run_service.service[count.index].location
|
| 754 |
+
role = "roles/run.developer"
|
| 755 |
+
members = [
|
| 756 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 757 |
+
]
|
| 758 |
+
}
|
| 759 |
+
|
| 760 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 761 |
+
count = length(var.microservices)
|
| 762 |
+
service = google_cloud_run_service.service[count.index].name
|
| 763 |
+
location = google_cloud_run_service.service[count.index].location
|
| 764 |
+
role = "roles/run.invoker"
|
| 765 |
+
members = [
|
| 766 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 767 |
+
]
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 771 |
+
count = length(var.microservices)
|
| 772 |
+
service = google_cloud_run_service.service[count.index].name
|
| 773 |
+
location = google_cloud_run_service.service[count.index].location
|
| 774 |
+
role = "roles/run.admin"
|
| 775 |
+
members = [
|
| 776 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 777 |
+
]
|
| 778 |
+
}
|
| 779 |
+
|
| 780 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 781 |
+
count = length(var.microservices)
|
| 782 |
+
service = google_cloud_run_service.service[count.index].name
|
| 783 |
+
location = google_cloud_run_service.service[count.index].location
|
| 784 |
+
role = "roles/run.viewer"
|
| 785 |
+
members = [
|
| 786 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 787 |
+
]
|
| 788 |
+
}
|
| 789 |
+
|
| 790 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 791 |
+
count = length(var.microservices)
|
| 792 |
+
service = google_cloud_run_service.service[count.index].name
|
| 793 |
+
location = google_cloud_run_service.service[count.index].location
|
| 794 |
+
role = "roles/run.developer"
|
| 795 |
+
members = [
|
| 796 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 797 |
+
]
|
| 798 |
+
}
|
| 799 |
+
|
| 800 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 801 |
+
count = length(var.microservices)
|
| 802 |
+
service = google_cloud_run_service.service[count.index].name
|
| 803 |
+
location = google_cloud_run_service.service[count.index].location
|
| 804 |
+
role = "roles/run.invoker"
|
| 805 |
+
members = [
|
| 806 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 807 |
+
]
|
| 808 |
+
}
|
| 809 |
+
|
| 810 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 811 |
+
count = length(var.microservices)
|
| 812 |
+
service = google_cloud_run_service.service[count.index].name
|
| 813 |
+
location = google_cloud_run_service.service[count.index].location
|
| 814 |
+
role = "roles/run.admin"
|
| 815 |
+
members = [
|
| 816 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 817 |
+
]
|
| 818 |
+
}
|
| 819 |
+
|
| 820 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 821 |
+
count = length(var.microservices)
|
| 822 |
+
service = google_cloud_run_service.service[count.index].name
|
| 823 |
+
location = google_cloud_run_service.service[count.index].location
|
| 824 |
+
role = "roles/run.viewer"
|
| 825 |
+
members = [
|
| 826 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 827 |
+
]
|
| 828 |
+
}
|
| 829 |
+
|
| 830 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 831 |
+
count = length(var.microservices)
|
| 832 |
+
service = google_cloud_run_service.service[count.index].name
|
| 833 |
+
location = google_cloud_run_service.service[count.index].location
|
| 834 |
+
role = "roles/run.developer"
|
| 835 |
+
members = [
|
| 836 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 837 |
+
]
|
| 838 |
+
}
|
| 839 |
+
|
| 840 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 841 |
+
count = length(var.microservices)
|
| 842 |
+
service = google_cloud_run_service.service[count.index].name
|
| 843 |
+
location = google_cloud_run_service.service[count.index].location
|
| 844 |
+
role = "roles/run.invoker"
|
| 845 |
+
members = [
|
| 846 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 847 |
+
]
|
| 848 |
+
}
|
| 849 |
+
|
| 850 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 851 |
+
count = length(var.microservices)
|
| 852 |
+
service = google_cloud_run_service.service[count.index].name
|
| 853 |
+
location = google_cloud_run_service.service[count.index].location
|
| 854 |
+
role = "roles/run.admin"
|
| 855 |
+
members = [
|
| 856 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 857 |
+
]
|
| 858 |
+
}
|
| 859 |
+
|
| 860 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 861 |
+
count = length(var.microservices)
|
| 862 |
+
service = google_cloud_run_service.service[count.index].name
|
| 863 |
+
location = google_cloud_run_service.service[count.index].location
|
| 864 |
+
role = "roles/run.viewer"
|
| 865 |
+
members = [
|
| 866 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 867 |
+
]
|
| 868 |
+
}
|
| 869 |
+
|
| 870 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 871 |
+
count = length(var.microservices)
|
| 872 |
+
service = google_cloud_run_service.service[count.index].name
|
| 873 |
+
location = google_cloud_run_service.service[count.index].location
|
| 874 |
+
role = "roles/run.developer"
|
| 875 |
+
members = [
|
| 876 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 877 |
+
]
|
| 878 |
+
}
|
| 879 |
+
|
| 880 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 881 |
+
count = length(var.microservices)
|
| 882 |
+
service = google_cloud_run_service.service[count.index].name
|
| 883 |
+
location = google_cloud_run_service.service[count.index].location
|
| 884 |
+
role = "roles/run.invoker"
|
| 885 |
+
members = [
|
| 886 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 887 |
+
]
|
| 888 |
+
}
|
| 889 |
+
|
| 890 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 891 |
+
count = length(var.microservices)
|
| 892 |
+
service = google_cloud_run_service.service[count.index].name
|
| 893 |
+
location = google_cloud_run_service.service[count.index].location
|
| 894 |
+
role = "roles/run.admin"
|
| 895 |
+
members = [
|
| 896 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 897 |
+
]
|
| 898 |
+
}
|
| 899 |
+
|
| 900 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 901 |
+
count = length(var.microservices)
|
| 902 |
+
service = google_cloud_run_service.service[count.index].name
|
| 903 |
+
location = google_cloud_run_service.service[count.index].location
|
| 904 |
+
role = "roles/run.viewer"
|
| 905 |
+
members = [
|
| 906 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 907 |
+
]
|
| 908 |
+
}
|
| 909 |
+
|
| 910 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 911 |
+
count = length(var.microservices)
|
| 912 |
+
service = google_cloud_run_service.service[count.index].name
|
| 913 |
+
location = google_cloud_run_service.service[count.index].location
|
| 914 |
+
role = "roles/run.developer"
|
| 915 |
+
members = [
|
| 916 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 917 |
+
]
|
| 918 |
+
}
|
| 919 |
+
|
| 920 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 921 |
+
count = length(var.microservices)
|
| 922 |
+
service = google_cloud_run_service.service[count.index].name
|
| 923 |
+
location = google_cloud_run_service.service[count.index].location
|
| 924 |
+
role = "roles/run.invoker"
|
| 925 |
+
members = [
|
| 926 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 927 |
+
]
|
| 928 |
+
}
|
| 929 |
+
|
| 930 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 931 |
+
count = length(var.microservices)
|
| 932 |
+
service = google_cloud_run_service.service[count.index].name
|
| 933 |
+
location = google_cloud_run_service.service[count.index].location
|
| 934 |
+
role = "roles/run.admin"
|
| 935 |
+
members = [
|
| 936 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 937 |
+
]
|
| 938 |
+
}
|
| 939 |
+
|
| 940 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 941 |
+
count = length(var.microservices)
|
| 942 |
+
service = google_cloud_run_service.service[count.index].name
|
| 943 |
+
location = google_cloud_run_service.service[count.index].location
|
| 944 |
+
role = "roles/run.viewer"
|
| 945 |
+
members = [
|
| 946 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 947 |
+
]
|
| 948 |
+
}
|
| 949 |
+
|
| 950 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 951 |
+
count = length(var.microservices)
|
| 952 |
+
service = google_cloud_run_service.service[count.index].name
|
| 953 |
+
location = google_cloud_run_service.service[count.index].location
|
| 954 |
+
role = "roles/run.developer"
|
| 955 |
+
members = [
|
| 956 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 957 |
+
]
|
| 958 |
+
}
|
| 959 |
+
|
| 960 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 961 |
+
count = length(var.microservices)
|
| 962 |
+
service = google_cloud_run_service.service[count.index].name
|
| 963 |
+
location = google_cloud_run_service.service[count.index].location
|
| 964 |
+
role = "roles/run.invoker"
|
| 965 |
+
members = [
|
| 966 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 967 |
+
]
|
| 968 |
+
}
|
| 969 |
+
|
| 970 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 971 |
+
count = length(var.microservices)
|
| 972 |
+
service = google_cloud_run_service.service[count.index].name
|
| 973 |
+
location = google_cloud_run_service.service[count.index].location
|
| 974 |
+
role = "roles/run.admin"
|
| 975 |
+
members = [
|
| 976 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 977 |
+
]
|
| 978 |
+
}
|
| 979 |
+
|
| 980 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 981 |
+
count = length(var.microservices)
|
| 982 |
+
service = google_cloud_run_service.service[count.index].name
|
| 983 |
+
location = google_cloud_run_service.service[count.index].location
|
| 984 |
+
role = "roles/run.viewer"
|
| 985 |
+
members = [
|
| 986 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 987 |
+
]
|
| 988 |
+
}
|
| 989 |
+
|
| 990 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 991 |
+
count = length(var.microservices)
|
| 992 |
+
service = google_cloud_run_service.service[count.index].name
|
| 993 |
+
location = google_cloud_run_service.service[count.index].location
|
| 994 |
+
role = "roles/run.developer"
|
| 995 |
+
members = [
|
| 996 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 997 |
+
]
|
| 998 |
+
}
|
| 999 |
+
|
| 1000 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1001 |
+
count = length(var.microservices)
|
| 1002 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1003 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1004 |
+
role = "roles/run.invoker"
|
| 1005 |
+
members = [
|
| 1006 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1007 |
+
]
|
| 1008 |
+
}
|
| 1009 |
+
|
| 1010 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1011 |
+
count = length(var.microservices)
|
| 1012 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1013 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1014 |
+
role = "roles/run.admin"
|
| 1015 |
+
members = [
|
| 1016 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1017 |
+
]
|
| 1018 |
+
}
|
| 1019 |
+
|
| 1020 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1021 |
+
count = length(var.microservices)
|
| 1022 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1023 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1024 |
+
role = "roles/run.viewer"
|
| 1025 |
+
members = [
|
| 1026 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1027 |
+
]
|
| 1028 |
+
}
|
| 1029 |
+
|
| 1030 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1031 |
+
count = length(var.microservices)
|
| 1032 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1033 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1034 |
+
role = "roles/run.developer"
|
| 1035 |
+
members = [
|
| 1036 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1037 |
+
]
|
| 1038 |
+
}
|
| 1039 |
+
|
| 1040 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1041 |
+
count = length(var.microservices)
|
| 1042 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1043 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1044 |
+
role = "roles/run.invoker"
|
| 1045 |
+
members = [
|
| 1046 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1047 |
+
]
|
| 1048 |
+
}
|
| 1049 |
+
|
| 1050 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1051 |
+
count = length(var.microservices)
|
| 1052 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1053 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1054 |
+
role = "roles/run.admin"
|
| 1055 |
+
members = [
|
| 1056 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1057 |
+
]
|
| 1058 |
+
}
|
| 1059 |
+
|
| 1060 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1061 |
+
count = length(var.microservices)
|
| 1062 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1063 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1064 |
+
role = "roles/run.viewer"
|
| 1065 |
+
members = [
|
| 1066 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1067 |
+
]
|
| 1068 |
+
}
|
| 1069 |
+
|
| 1070 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1071 |
+
count = length(var.microservices)
|
| 1072 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1073 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1074 |
+
role = "roles/run.developer"
|
| 1075 |
+
members = [
|
| 1076 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1077 |
+
]
|
| 1078 |
+
}
|
| 1079 |
+
|
| 1080 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1081 |
+
count = length(var.microservices)
|
| 1082 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1083 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1084 |
+
role = "roles/run.invoker"
|
| 1085 |
+
members = [
|
| 1086 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1087 |
+
]
|
| 1088 |
+
}
|
| 1089 |
+
|
| 1090 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1091 |
+
count = length(var.microservices)
|
| 1092 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1093 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1094 |
+
role = "roles/run.admin"
|
| 1095 |
+
members = [
|
| 1096 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1097 |
+
]
|
| 1098 |
+
}
|
| 1099 |
+
|
| 1100 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1101 |
+
count = length(var.microservices)
|
| 1102 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1103 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1104 |
+
role = "roles/run.viewer"
|
| 1105 |
+
members = [
|
| 1106 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1107 |
+
]
|
| 1108 |
+
}
|
| 1109 |
+
|
| 1110 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1111 |
+
count = length(var.microservices)
|
| 1112 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1113 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1114 |
+
role = "roles/run.developer"
|
| 1115 |
+
members = [
|
| 1116 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1117 |
+
]
|
| 1118 |
+
}
|
| 1119 |
+
|
| 1120 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1121 |
+
count = length(var.microservices)
|
| 1122 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1123 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1124 |
+
role = "roles/run.invoker"
|
| 1125 |
+
members = [
|
| 1126 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1127 |
+
]
|
| 1128 |
+
}
|
| 1129 |
+
|
| 1130 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1131 |
+
count = length(var.microservices)
|
| 1132 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1133 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1134 |
+
role = "roles/run.admin"
|
| 1135 |
+
members = [
|
| 1136 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1137 |
+
]
|
| 1138 |
+
}
|
| 1139 |
+
|
| 1140 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1141 |
+
count = length(var.microservices)
|
| 1142 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1143 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1144 |
+
role = "roles/run.viewer"
|
| 1145 |
+
members = [
|
| 1146 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1147 |
+
]
|
| 1148 |
+
}
|
| 1149 |
+
|
| 1150 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1151 |
+
count = length(var.microservices)
|
| 1152 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1153 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1154 |
+
role = "roles/run.developer"
|
| 1155 |
+
members = [
|
| 1156 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1157 |
+
]
|
| 1158 |
+
}
|
| 1159 |
+
|
| 1160 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1161 |
+
count = length(var.microservices)
|
| 1162 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1163 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1164 |
+
role = "roles/run.invoker"
|
| 1165 |
+
members = [
|
| 1166 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1167 |
+
]
|
| 1168 |
+
}
|
| 1169 |
+
|
| 1170 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1171 |
+
count = length(var.microservices)
|
| 1172 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1173 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1174 |
+
role = "roles/run.admin"
|
| 1175 |
+
members = [
|
| 1176 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1177 |
+
]
|
| 1178 |
+
}
|
| 1179 |
+
|
| 1180 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1181 |
+
count = length(var.microservices)
|
| 1182 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1183 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1184 |
+
role = "roles/run.viewer"
|
| 1185 |
+
members = [
|
| 1186 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1187 |
+
]
|
| 1188 |
+
}
|
| 1189 |
+
|
| 1190 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1191 |
+
count = length(var.microservices)
|
| 1192 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1193 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1194 |
+
role = "roles/run.developer"
|
| 1195 |
+
members = [
|
| 1196 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1197 |
+
]
|
| 1198 |
+
}
|
| 1199 |
+
|
| 1200 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1201 |
+
count = length(var.microservices)
|
| 1202 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1203 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1204 |
+
role = "roles/run.invoker"
|
| 1205 |
+
members = [
|
| 1206 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1207 |
+
]
|
| 1208 |
+
}
|
| 1209 |
+
|
| 1210 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1211 |
+
count = length(var.microservices)
|
| 1212 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1213 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1214 |
+
role = "roles/run.admin"
|
| 1215 |
+
members = [
|
| 1216 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1217 |
+
]
|
| 1218 |
+
}
|
| 1219 |
+
|
| 1220 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1221 |
+
count = length(var.microservices)
|
| 1222 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1223 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1224 |
+
role = "roles/run.viewer"
|
| 1225 |
+
members = [
|
| 1226 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1227 |
+
]
|
| 1228 |
+
}
|
| 1229 |
+
|
| 1230 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1231 |
+
count = length(var.microservices)
|
| 1232 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1233 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1234 |
+
role = "roles/run.developer"
|
| 1235 |
+
members = [
|
| 1236 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1237 |
+
]
|
| 1238 |
+
}
|
| 1239 |
+
|
| 1240 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1241 |
+
count = length(var.microservices)
|
| 1242 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1243 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1244 |
+
role = "roles/run.invoker"
|
| 1245 |
+
members = [
|
| 1246 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1247 |
+
]
|
| 1248 |
+
}
|
| 1249 |
+
|
| 1250 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1251 |
+
count = length(var.microservices)
|
| 1252 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1253 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1254 |
+
role = "roles/run.admin"
|
| 1255 |
+
members = [
|
| 1256 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1257 |
+
]
|
| 1258 |
+
}
|
| 1259 |
+
|
| 1260 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1261 |
+
count = length(var.microservices)
|
| 1262 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1263 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1264 |
+
role = "roles/run.viewer"
|
| 1265 |
+
members = [
|
| 1266 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1267 |
+
]
|
| 1268 |
+
}
|
| 1269 |
+
|
| 1270 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1271 |
+
count = length(var.microservices)
|
| 1272 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1273 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1274 |
+
role = "roles/run.developer"
|
| 1275 |
+
members = [
|
| 1276 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1277 |
+
]
|
| 1278 |
+
}
|
| 1279 |
+
|
| 1280 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1281 |
+
count = length(var.microservices)
|
| 1282 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1283 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1284 |
+
role = "roles/run.invoker"
|
| 1285 |
+
members = [
|
| 1286 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1287 |
+
]
|
| 1288 |
+
}
|
| 1289 |
+
|
| 1290 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1291 |
+
count = length(var.microservices)
|
| 1292 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1293 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1294 |
+
role = "roles/run.admin"
|
| 1295 |
+
members = [
|
| 1296 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1297 |
+
]
|
| 1298 |
+
}
|
| 1299 |
+
|
| 1300 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1301 |
+
count = length(var.microservices)
|
| 1302 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1303 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1304 |
+
role = "roles/run.viewer"
|
| 1305 |
+
members = [
|
| 1306 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1307 |
+
]
|
| 1308 |
+
}
|
| 1309 |
+
|
| 1310 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1311 |
+
count = length(var.microservices)
|
| 1312 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1313 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1314 |
+
role = "roles/run.developer"
|
| 1315 |
+
members = [
|
| 1316 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1317 |
+
]
|
| 1318 |
+
}
|
| 1319 |
+
|
| 1320 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1321 |
+
count = length(var.microservices)
|
| 1322 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1323 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1324 |
+
role = "roles/run.invoker"
|
| 1325 |
+
members = [
|
| 1326 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1327 |
+
]
|
| 1328 |
+
}
|
| 1329 |
+
|
| 1330 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1331 |
+
count = length(var.microservices)
|
| 1332 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1333 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1334 |
+
role = "roles/run.admin"
|
| 1335 |
+
members = [
|
| 1336 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1337 |
+
]
|
| 1338 |
+
}
|
| 1339 |
+
|
| 1340 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1341 |
+
count = length(var.microservices)
|
| 1342 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1343 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1344 |
+
role = "roles/run.viewer"
|
| 1345 |
+
members = [
|
| 1346 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1347 |
+
]
|
| 1348 |
+
}
|
| 1349 |
+
|
| 1350 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1351 |
+
count = length(var.microservices)
|
| 1352 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1353 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1354 |
+
role = "roles/run.developer"
|
| 1355 |
+
members = [
|
| 1356 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1357 |
+
]
|
| 1358 |
+
}
|
| 1359 |
+
|
| 1360 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1361 |
+
count = length(var.microservices)
|
| 1362 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1363 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1364 |
+
role = "roles/run.invoker"
|
| 1365 |
+
members = [
|
| 1366 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1367 |
+
]
|
| 1368 |
+
}
|
| 1369 |
+
|
| 1370 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1371 |
+
count = length(var.microservices)
|
| 1372 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1373 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1374 |
+
role = "roles/run.admin"
|
| 1375 |
+
members = [
|
| 1376 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1377 |
+
]
|
| 1378 |
+
}
|
| 1379 |
+
|
| 1380 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1381 |
+
count = length(var.microservices)
|
| 1382 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1383 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1384 |
+
role = "roles/run.viewer"
|
| 1385 |
+
members = [
|
| 1386 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1387 |
+
]
|
| 1388 |
+
}
|
| 1389 |
+
|
| 1390 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1391 |
+
count = length(var.microservices)
|
| 1392 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1393 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1394 |
+
role = "roles/run.developer"
|
| 1395 |
+
members = [
|
| 1396 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1397 |
+
]
|
| 1398 |
+
}
|
| 1399 |
+
|
| 1400 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1401 |
+
count = length(var.microservices)
|
| 1402 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1403 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1404 |
+
role = "roles/run.invoker"
|
| 1405 |
+
members = [
|
| 1406 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1407 |
+
]
|
| 1408 |
+
}
|
| 1409 |
+
|
| 1410 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1411 |
+
count = length(var.microservices)
|
| 1412 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1413 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1414 |
+
role = "roles/run.admin"
|
| 1415 |
+
members = [
|
| 1416 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1417 |
+
]
|
| 1418 |
+
}
|
| 1419 |
+
|
| 1420 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1421 |
+
count = length(var.microservices)
|
| 1422 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1423 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1424 |
+
role = "roles/run.viewer"
|
| 1425 |
+
members = [
|
| 1426 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1427 |
+
]
|
| 1428 |
+
}
|
| 1429 |
+
|
| 1430 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1431 |
+
count = length(var.microservices)
|
| 1432 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1433 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1434 |
+
role = "roles/run.developer"
|
| 1435 |
+
members = [
|
| 1436 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1437 |
+
]
|
| 1438 |
+
}
|
| 1439 |
+
|
| 1440 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1441 |
+
count = length(var.microservices)
|
| 1442 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1443 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1444 |
+
role = "roles/run.invoker"
|
| 1445 |
+
members = [
|
| 1446 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1447 |
+
]
|
| 1448 |
+
}
|
| 1449 |
+
|
| 1450 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1451 |
+
count = length(var.microservices)
|
| 1452 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1453 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1454 |
+
role = "roles/run.admin"
|
| 1455 |
+
members = [
|
| 1456 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1457 |
+
]
|
| 1458 |
+
}
|
| 1459 |
+
|
| 1460 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1461 |
+
count = length(var.microservices)
|
| 1462 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1463 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1464 |
+
role = "roles/run.viewer"
|
| 1465 |
+
members = [
|
| 1466 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1467 |
+
]
|
| 1468 |
+
}
|
| 1469 |
+
|
| 1470 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1471 |
+
count = length(var.microservices)
|
| 1472 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1473 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1474 |
+
role = "roles/run.developer"
|
| 1475 |
+
members = [
|
| 1476 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1477 |
+
]
|
| 1478 |
+
}
|
| 1479 |
+
|
| 1480 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1481 |
+
count = length(var.microservices)
|
| 1482 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1483 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1484 |
+
role = "roles/run.invoker"
|
| 1485 |
+
members = [
|
| 1486 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1487 |
+
]
|
| 1488 |
+
}
|
| 1489 |
+
|
| 1490 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1491 |
+
count = length(var.microservices)
|
| 1492 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1493 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1494 |
+
role = "roles/run.admin"
|
| 1495 |
+
members = [
|
| 1496 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1497 |
+
]
|
| 1498 |
+
}
|
| 1499 |
+
|
| 1500 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1501 |
+
count = length(var.microservices)
|
| 1502 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1503 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1504 |
+
role = "roles/run.viewer"
|
| 1505 |
+
members = [
|
| 1506 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1507 |
+
]
|
| 1508 |
+
}
|
| 1509 |
+
|
| 1510 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1511 |
+
count = length(var.microservices)
|
| 1512 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1513 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1514 |
+
role = "roles/run.developer"
|
| 1515 |
+
members = [
|
| 1516 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1517 |
+
]
|
| 1518 |
+
}
|
| 1519 |
+
|
| 1520 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1521 |
+
count = length(var.microservices)
|
| 1522 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1523 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1524 |
+
role = "roles/run.invoker"
|
| 1525 |
+
members = [
|
| 1526 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1527 |
+
]
|
| 1528 |
+
}
|
| 1529 |
+
|
| 1530 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1531 |
+
count = length(var.microservices)
|
| 1532 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1533 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1534 |
+
role = "roles/run.admin"
|
| 1535 |
+
members = [
|
| 1536 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1537 |
+
]
|
| 1538 |
+
}
|
| 1539 |
+
|
| 1540 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1541 |
+
count = length(var.microservices)
|
| 1542 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1543 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1544 |
+
role = "roles/run.viewer"
|
| 1545 |
+
members = [
|
| 1546 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1547 |
+
]
|
| 1548 |
+
}
|
| 1549 |
+
|
| 1550 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1551 |
+
count = length(var.microservices)
|
| 1552 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1553 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1554 |
+
role = "roles/run.developer"
|
| 1555 |
+
members = [
|
| 1556 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1557 |
+
]
|
| 1558 |
+
}
|
| 1559 |
+
|
| 1560 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1561 |
+
count = length(var.microservices)
|
| 1562 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1563 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1564 |
+
role = "roles/run.invoker"
|
| 1565 |
+
members = [
|
| 1566 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1567 |
+
]
|
| 1568 |
+
}
|
| 1569 |
+
|
| 1570 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1571 |
+
count = length(var.microservices)
|
| 1572 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1573 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1574 |
+
role = "roles/run.admin"
|
| 1575 |
+
members = [
|
| 1576 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1577 |
+
]
|
| 1578 |
+
}
|
| 1579 |
+
|
| 1580 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1581 |
+
count = length(var.microservices)
|
| 1582 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1583 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1584 |
+
role = "roles/run.viewer"
|
| 1585 |
+
members = [
|
| 1586 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1587 |
+
]
|
| 1588 |
+
}
|
| 1589 |
+
|
| 1590 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1591 |
+
count = length(var.microservices)
|
| 1592 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1593 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1594 |
+
role = "roles/run.developer"
|
| 1595 |
+
members = [
|
| 1596 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1597 |
+
]
|
| 1598 |
+
}
|
| 1599 |
+
|
| 1600 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1601 |
+
count = length(var.microservices)
|
| 1602 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1603 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1604 |
+
role = "roles/run.invoker"
|
| 1605 |
+
members = [
|
| 1606 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1607 |
+
]
|
| 1608 |
+
}
|
| 1609 |
+
|
| 1610 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1611 |
+
count = length(var.microservices)
|
| 1612 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1613 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1614 |
+
role = "roles/run.admin"
|
| 1615 |
+
members = [
|
| 1616 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1617 |
+
]
|
| 1618 |
+
}
|
| 1619 |
+
|
| 1620 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1621 |
+
count = length(var.microservices)
|
| 1622 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1623 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1624 |
+
role = "roles/run.viewer"
|
| 1625 |
+
members = [
|
| 1626 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1627 |
+
]
|
| 1628 |
+
}
|
| 1629 |
+
|
| 1630 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1631 |
+
count = length(var.microservices)
|
| 1632 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1633 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1634 |
+
role = "roles/run.developer"
|
| 1635 |
+
members = [
|
| 1636 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1637 |
+
]
|
| 1638 |
+
}
|
| 1639 |
+
|
| 1640 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1641 |
+
count = length(var.microservices)
|
| 1642 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1643 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1644 |
+
role = "roles/run.invoker"
|
| 1645 |
+
members = [
|
| 1646 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1647 |
+
]
|
| 1648 |
+
}
|
| 1649 |
+
|
| 1650 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1651 |
+
count = length(var.microservices)
|
| 1652 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1653 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1654 |
+
role = "roles/run.admin"
|
| 1655 |
+
members = [
|
| 1656 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1657 |
+
]
|
| 1658 |
+
}
|
| 1659 |
+
|
| 1660 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1661 |
+
count = length(var.microservices)
|
| 1662 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1663 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1664 |
+
role = "roles/run.viewer"
|
| 1665 |
+
members = [
|
| 1666 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1667 |
+
]
|
| 1668 |
+
}
|
| 1669 |
+
|
| 1670 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1671 |
+
count = length(var.microservices)
|
| 1672 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1673 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1674 |
+
role = "roles/run.developer"
|
| 1675 |
+
members = [
|
| 1676 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1677 |
+
]
|
| 1678 |
+
}
|
| 1679 |
+
|
| 1680 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1681 |
+
count = length(var.microservices)
|
| 1682 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1683 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1684 |
+
role = "roles/run.invoker"
|
| 1685 |
+
members = [
|
| 1686 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1687 |
+
]
|
| 1688 |
+
}
|
| 1689 |
+
|
| 1690 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1691 |
+
count = length(var.microservices)
|
| 1692 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1693 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1694 |
+
role = "roles/run.admin"
|
| 1695 |
+
members = [
|
| 1696 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1697 |
+
]
|
| 1698 |
+
}
|
| 1699 |
+
|
| 1700 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1701 |
+
count = length(var.microservices)
|
| 1702 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1703 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1704 |
+
role = "roles/run.viewer"
|
| 1705 |
+
members = [
|
| 1706 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1707 |
+
]
|
| 1708 |
+
}
|
| 1709 |
+
|
| 1710 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1711 |
+
count = length(var.microservices)
|
| 1712 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1713 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1714 |
+
role = "roles/run.developer"
|
| 1715 |
+
members = [
|
| 1716 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1717 |
+
]
|
| 1718 |
+
}
|
| 1719 |
+
|
| 1720 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1721 |
+
count = length(var.microservices)
|
| 1722 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1723 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1724 |
+
role = "roles/run.invoker"
|
| 1725 |
+
members = [
|
| 1726 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1727 |
+
]
|
| 1728 |
+
}
|
| 1729 |
+
|
| 1730 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1731 |
+
count = length(var.microservices)
|
| 1732 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1733 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1734 |
+
role = "roles/run.admin"
|
| 1735 |
+
members = [
|
| 1736 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1737 |
+
]
|
| 1738 |
+
}
|
| 1739 |
+
|
| 1740 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1741 |
+
count = length(var.microservices)
|
| 1742 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1743 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1744 |
+
role = "roles/run.viewer"
|
| 1745 |
+
members = [
|
| 1746 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1747 |
+
]
|
| 1748 |
+
}
|
| 1749 |
+
|
| 1750 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1751 |
+
count = length(var.microservices)
|
| 1752 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1753 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1754 |
+
role = "roles/run.developer"
|
| 1755 |
+
members = [
|
| 1756 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1757 |
+
]
|
| 1758 |
+
}
|
| 1759 |
+
|
| 1760 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1761 |
+
count = length(var.microservices)
|
| 1762 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1763 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1764 |
+
role = "roles/run.invoker"
|
| 1765 |
+
members = [
|
| 1766 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1767 |
+
]
|
| 1768 |
+
}
|
| 1769 |
+
|
| 1770 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1771 |
+
count = length(var.microservices)
|
| 1772 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1773 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1774 |
+
role = "roles/run.admin"
|
| 1775 |
+
members = [
|
| 1776 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1777 |
+
]
|
| 1778 |
+
}
|
| 1779 |
+
|
| 1780 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1781 |
+
count = length(var.microservices)
|
| 1782 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1783 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1784 |
+
role = "roles/run.viewer"
|
| 1785 |
+
members = [
|
| 1786 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1787 |
+
]
|
| 1788 |
+
}
|
| 1789 |
+
|
| 1790 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1791 |
+
count = length(var.microservices)
|
| 1792 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1793 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1794 |
+
role = "roles/run.developer"
|
| 1795 |
+
members = [
|
| 1796 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1797 |
+
]
|
| 1798 |
+
}
|
| 1799 |
+
|
| 1800 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1801 |
+
count = length(var.microservices)
|
| 1802 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1803 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1804 |
+
role = "roles/run.invoker"
|
| 1805 |
+
members = [
|
| 1806 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1807 |
+
]
|
| 1808 |
+
}
|
| 1809 |
+
|
| 1810 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1811 |
+
count = length(var.microservices)
|
| 1812 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1813 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1814 |
+
role = "roles/run.admin"
|
| 1815 |
+
members = [
|
| 1816 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1817 |
+
]
|
| 1818 |
+
}
|
| 1819 |
+
|
| 1820 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1821 |
+
count = length(var.microservices)
|
| 1822 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1823 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1824 |
+
role = "roles/run.viewer"
|
| 1825 |
+
members = [
|
| 1826 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1827 |
+
]
|
| 1828 |
+
}
|
| 1829 |
+
|
| 1830 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1831 |
+
count = length(var.microservices)
|
| 1832 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1833 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1834 |
+
role = "roles/run.developer"
|
| 1835 |
+
members = [
|
| 1836 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1837 |
+
]
|
| 1838 |
+
}
|
| 1839 |
+
|
| 1840 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1841 |
+
count = length(var.microservices)
|
| 1842 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1843 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1844 |
+
role = "roles/run.invoker"
|
| 1845 |
+
members = [
|
| 1846 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1847 |
+
]
|
| 1848 |
+
}
|
| 1849 |
+
|
| 1850 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1851 |
+
count = length(var.microservices)
|
| 1852 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1853 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1854 |
+
role = "roles/run.admin"
|
| 1855 |
+
members = [
|
| 1856 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1857 |
+
]
|
| 1858 |
+
}
|
| 1859 |
+
|
| 1860 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1861 |
+
count = length(var.microservices)
|
| 1862 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1863 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1864 |
+
role = "roles/run.viewer"
|
| 1865 |
+
members = [
|
| 1866 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1867 |
+
]
|
| 1868 |
+
}
|
| 1869 |
+
|
| 1870 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1871 |
+
count = length(var.microservices)
|
| 1872 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1873 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1874 |
+
role = "roles/run.developer"
|
| 1875 |
+
members = [
|
| 1876 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1877 |
+
]
|
| 1878 |
+
}
|
| 1879 |
+
|
| 1880 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1881 |
+
count = length(var.microservices)
|
| 1882 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1883 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1884 |
+
role = "roles/run.invoker"
|
| 1885 |
+
members = [
|
| 1886 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1887 |
+
]
|
| 1888 |
+
}
|
| 1889 |
+
|
| 1890 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1891 |
+
count = length(var.microservices)
|
| 1892 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1893 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1894 |
+
role = "roles/run.admin"
|
| 1895 |
+
members = [
|
| 1896 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1897 |
+
]
|
| 1898 |
+
}
|
| 1899 |
+
|
| 1900 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1901 |
+
count = length(var.microservices)
|
| 1902 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1903 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1904 |
+
role = "roles/run.viewer"
|
| 1905 |
+
members = [
|
| 1906 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1907 |
+
]
|
| 1908 |
+
}
|
| 1909 |
+
|
| 1910 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1911 |
+
count = length(var.microservices)
|
| 1912 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1913 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1914 |
+
role = "roles/run.developer"
|
| 1915 |
+
members = [
|
| 1916 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1917 |
+
]
|
| 1918 |
+
}
|
| 1919 |
+
|
| 1920 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_invoker" {
|
| 1921 |
+
count = length(var.microservices)
|
| 1922 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1923 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1924 |
+
role = "roles/run.invoker"
|
| 1925 |
+
members = [
|
| 1926 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1927 |
+
]
|
| 1928 |
+
}
|
| 1929 |
+
|
| 1930 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_admin" {
|
| 1931 |
+
count = length(var.microservices)
|
| 1932 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1933 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1934 |
+
role = "roles/run.admin"
|
| 1935 |
+
members = [
|
| 1936 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1937 |
+
]
|
| 1938 |
+
}
|
| 1939 |
+
|
| 1940 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_viewer" {
|
| 1941 |
+
count = length(var.microservices)
|
| 1942 |
+
service = google_cloud_run_service.service[count.index].name
|
| 1943 |
+
location = google_cloud_run_service.service[count.index].location
|
| 1944 |
+
role = "roles/run.viewer"
|
| 1945 |
+
members = [
|
| 1946 |
+
"serviceAccount:${google_service_account.microservice_sa[count.index].email}"
|
| 1947 |
+
]
|
| 1948 |
+
}
|
| 1949 |
+
|
| 1950 |
+
resource "google_cloud_run_service_iam_binding" "cloud_run_developer" {
|
| 1951 |
+
count = length(var.microservices)
|
| 1952 |
+
service = google_cloud_run_service.service[count.index].name
|
generated/complex/gpt-4o/complex-gcp-tf-003/main.tf
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "google" {
|
| 2 |
+
project = "your-gcp-project-id"
|
| 3 |
+
region = "us-central1"
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
resource "google_pubsub_topic" "ordered_topic" {
|
| 7 |
+
name = "ordered-topic"
|
| 8 |
+
message_storage_policy {
|
| 9 |
+
allowed_persistence_regions = ["us-central1"]
|
| 10 |
+
}
|
| 11 |
+
kms_key_name = "projects/your-gcp-project-id/locations/global/keyRings/your-keyring/cryptoKeys/your-key"
|
| 12 |
+
enable_message_ordering = true
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
resource "google_pubsub_topic" "dead_letter_topic" {
|
| 16 |
+
name = "dead-letter-topic"
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
resource "google_pubsub_subscription" "ordered_subscription" {
|
| 20 |
+
name = "ordered-subscription"
|
| 21 |
+
topic = google_pubsub_topic.ordered_topic.id
|
| 22 |
+
|
| 23 |
+
dead_letter_policy {
|
| 24 |
+
dead_letter_topic = google_pubsub_topic.dead_letter_topic.id
|
| 25 |
+
max_delivery_attempts = 5
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
resource "google_dataflow_job" "streaming_job" {
|
| 30 |
+
name = "streaming-job"
|
| 31 |
+
template_gcs_path = "gs://dataflow-templates/latest/Stream_GCS_Text_to_BigQuery"
|
| 32 |
+
parameters = {
|
| 33 |
+
inputFilePattern = "gs://your-bucket/input/*"
|
| 34 |
+
outputTable = "your-gcp-project-id:your_dataset.your_table"
|
| 35 |
+
}
|
| 36 |
+
max_workers = 10
|
| 37 |
+
on_delete = "cancel"
|
| 38 |
+
enable_streaming_engine = true
|
| 39 |
+
dataflow_service_options = ["enable_prime"]
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
resource "google_bigquery_dataset" "streaming_dataset" {
|
| 43 |
+
dataset_id = "your_dataset"
|
| 44 |
+
location = "US"
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
resource "google_bigquery_table" "streaming_table" {
|
| 48 |
+
dataset_id = google_bigquery_dataset.streaming_dataset.dataset_id
|
| 49 |
+
table_id = "your_table"
|
| 50 |
+
time_partitioning {
|
| 51 |
+
type = "DAY"
|
| 52 |
+
}
|
| 53 |
+
clustering {
|
| 54 |
+
fields = ["column1", "column2"]
|
| 55 |
+
}
|
| 56 |
+
encryption_configuration {
|
| 57 |
+
kms_key_name = "projects/your-gcp-project-id/locations/global/keyRings/your-keyring/cryptoKeys/your-key"
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
resource "google_bigtable_instance" "analytics_instance" {
|
| 62 |
+
name = "analytics-instance"
|
| 63 |
+
cluster {
|
| 64 |
+
cluster_id = "cluster-1"
|
| 65 |
+
zone = "us-central1-b"
|
| 66 |
+
num_nodes = 3
|
| 67 |
+
storage_type = "SSD"
|
| 68 |
+
}
|
| 69 |
+
cluster {
|
| 70 |
+
cluster_id = "cluster-2"
|
| 71 |
+
zone = "us-central1-c"
|
| 72 |
+
num_nodes = 3
|
| 73 |
+
storage_type = "SSD"
|
| 74 |
+
}
|
| 75 |
+
instance_type = "PRODUCTION"
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
resource "google_composer_environment" "composer_env" {
|
| 79 |
+
name = "composer-env"
|
| 80 |
+
region = "us-central1"
|
| 81 |
+
|
| 82 |
+
config {
|
| 83 |
+
node_count = 3
|
| 84 |
+
software_config {
|
| 85 |
+
image_version = "composer-2.0.0-airflow-2.1.2"
|
| 86 |
+
python_version = "3"
|
| 87 |
+
}
|
| 88 |
+
private_environment_config {
|
| 89 |
+
enable_private_environment = true
|
| 90 |
+
}
|
| 91 |
+
encryption_config {
|
| 92 |
+
kms_key_name = "projects/your-gcp-project-id/locations/global/keyRings/your-keyring/cryptoKeys/your-key"
|
| 93 |
+
}
|
| 94 |
+
dag_gcs_prefix = "gs://your-composer-bucket/dags"
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
resource "google_storage_bucket" "composer_bucket" {
|
| 99 |
+
name = "your-composer-bucket"
|
| 100 |
+
location = "US"
|
| 101 |
+
versioning {
|
| 102 |
+
enabled = true
|
| 103 |
+
}
|
| 104 |
+
encryption {
|
| 105 |
+
default_kms_key_name = "projects/your-gcp-project-id/locations/global/keyRings/your-keyring/cryptoKeys/your-key"
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
resource "google_vpc_access_connector" "vpc_connector" {
|
| 110 |
+
name = "vpc-connector"
|
| 111 |
+
region = "us-central1"
|
| 112 |
+
network = "default"
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
resource "google_kms_key_ring" "keyring" {
|
| 116 |
+
name = "your-keyring"
|
| 117 |
+
location = "global"
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
resource "google_kms_crypto_key" "crypto_key" {
|
| 121 |
+
name = "your-key"
|
| 122 |
+
key_ring = google_kms_key_ring.keyring.id
|
| 123 |
+
rotation_period = "7776000s" # 90 days
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
resource "google_data_catalog_policy_tag" "policy_tag" {
|
| 127 |
+
display_name = "Sensitive"
|
| 128 |
+
taxonomy = "projects/your-gcp-project-id/locations/us-central1/taxonomies/your-taxonomy"
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
resource "google_data_loss_prevention_job_trigger" "dlp_job" {
|
| 132 |
+
display_name = "dlp-job"
|
| 133 |
+
inspect_job {
|
| 134 |
+
storage_config {
|
| 135 |
+
big_query_options {
|
| 136 |
+
table_reference {
|
| 137 |
+
project_id = "your-gcp-project-id"
|
| 138 |
+
dataset_id = google_bigquery_dataset.streaming_dataset.dataset_id
|
| 139 |
+
table_id = google_bigquery_table.streaming_table.table_id
|
| 140 |
+
}
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
inspect_config {
|
| 144 |
+
info_types {
|
| 145 |
+
name = "PERSON_NAME"
|
| 146 |
+
}
|
| 147 |
+
info_types {
|
| 148 |
+
name = "EMAIL_ADDRESS"
|
| 149 |
+
}
|
| 150 |
+
limits {
|
| 151 |
+
max_findings_per_request = 0
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
triggers {
|
| 156 |
+
schedule {
|
| 157 |
+
recurrence_period_duration = "86400s" # Daily
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
resource "google_vpc_service_controls_service_perimeter" "service_perimeter" {
|
| 163 |
+
name = "projects/your-gcp-project-id/servicePerimeters/your-perimeter"
|
| 164 |
+
title = "Service Perimeter"
|
| 165 |
+
status {
|
| 166 |
+
resources = [
|
| 167 |
+
"projects/your-gcp-project-id"
|
| 168 |
+
]
|
| 169 |
+
restricted_services = [
|
| 170 |
+
"bigquery.googleapis.com",
|
| 171 |
+
"pubsub.googleapis.com",
|
| 172 |
+
"bigtable.googleapis.com",
|
| 173 |
+
"storage.googleapis.com"
|
| 174 |
+
]
|
| 175 |
+
}
|
| 176 |
+
}
|
generated/complex/gpt-4o/complex-gcp-tf-004/main.tf
ADDED
|
@@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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "google" {
|
| 2 |
+
project = var.project_id
|
| 3 |
+
region = var.region
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
resource "google_project" "dev" {
|
| 7 |
+
name = "dev-environment"
|
| 8 |
+
project_id = "dev-${var.project_id}"
|
| 9 |
+
org_id = var.org_id
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
resource "google_project" "staging" {
|
| 13 |
+
name = "staging-environment"
|
| 14 |
+
project_id = "staging-${var.project_id}"
|
| 15 |
+
org_id = var.org_id
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
resource "google_project" "prod" {
|
| 19 |
+
name = "prod-environment"
|
| 20 |
+
project_id = "prod-${var.project_id}"
|
| 21 |
+
org_id = var.org_id
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
resource "google_service_account" "cloud_build" {
|
| 25 |
+
account_id = "cloud-build-sa"
|
| 26 |
+
display_name = "Cloud Build Service Account"
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
resource "google_project_iam_member" "cloud_build_sa" {
|
| 30 |
+
project = google_project.dev.project_id
|
| 31 |
+
role = "roles/editor"
|
| 32 |
+
member = "serviceAccount:${google_service_account.cloud_build.email}"
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
resource "google_project_iam_member" "cloud_build_sa_staging" {
|
| 36 |
+
project = google_project.staging.project_id
|
| 37 |
+
role = "roles/editor"
|
| 38 |
+
member = "serviceAccount:${google_service_account.cloud_build.email}"
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
resource "google_project_iam_member" "cloud_build_sa_prod" {
|
| 42 |
+
project = google_project.prod.project_id
|
| 43 |
+
role = "roles/editor"
|
| 44 |
+
member = "serviceAccount:${google_service_account.cloud_build.email}"
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
resource "google_cloudbuild_trigger" "github_trigger" {
|
| 48 |
+
project = google_project.dev.project_id
|
| 49 |
+
trigger_template {
|
| 50 |
+
repo_name = "your-repo"
|
| 51 |
+
branch_name = "main"
|
| 52 |
+
}
|
| 53 |
+
github {
|
| 54 |
+
owner = "your-org"
|
| 55 |
+
name = "your-repo"
|
| 56 |
+
push {
|
| 57 |
+
branch = "main"
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
build {
|
| 61 |
+
steps {
|
| 62 |
+
name = "gcr.io/cloud-builders/docker"
|
| 63 |
+
args = ["build", "-t", "gcr.io/${google_project.dev.project_id}/app", "."]
|
| 64 |
+
}
|
| 65 |
+
steps {
|
| 66 |
+
name = "gcr.io/cloud-builders/gcloud"
|
| 67 |
+
args = ["beta", "container", "images", "describe", "gcr.io/${google_project.dev.project_id}/app"]
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
resource "google_artifact_registry_repository" "repo" {
|
| 73 |
+
project = google_project.dev.project_id
|
| 74 |
+
location = var.region
|
| 75 |
+
repository_id = "my-repo"
|
| 76 |
+
format = "DOCKER"
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
resource "google_cloudfunctions_function" "notify_chat" {
|
| 80 |
+
name = "notify-chat"
|
| 81 |
+
runtime = "nodejs14"
|
| 82 |
+
entry_point = "notifyChat"
|
| 83 |
+
source_archive_bucket = google_storage_bucket.source_archive_bucket.name
|
| 84 |
+
source_archive_object = google_storage_bucket_object.source_archive.name
|
| 85 |
+
trigger_http = true
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
resource "google_storage_bucket" "source_archive_bucket" {
|
| 89 |
+
name = "${var.project_id}-source"
|
| 90 |
+
location = var.region
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
resource "google_storage_bucket_object" "source_archive" {
|
| 94 |
+
name = "function-source.zip"
|
| 95 |
+
bucket = google_storage_bucket.source_archive_bucket.name
|
| 96 |
+
source = "function-source.zip"
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
resource "google_clouddeploy_delivery_pipeline" "pipeline" {
|
| 100 |
+
project = google_project.dev.project_id
|
| 101 |
+
name = "my-pipeline"
|
| 102 |
+
serial_pipeline {
|
| 103 |
+
stages {
|
| 104 |
+
target_id = "dev"
|
| 105 |
+
profiles = ["canary"]
|
| 106 |
+
}
|
| 107 |
+
stages {
|
| 108 |
+
target_id = "staging"
|
| 109 |
+
profiles = ["canary"]
|
| 110 |
+
}
|
| 111 |
+
stages {
|
| 112 |
+
target_id = "prod"
|
| 113 |
+
profiles = ["canary"]
|
| 114 |
+
}
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
resource "google_clouddeploy_target" "dev" {
|
| 119 |
+
project = google_project.dev.project_id
|
| 120 |
+
name = "dev"
|
| 121 |
+
gke {
|
| 122 |
+
cluster = "projects/${google_project.dev.project_id}/locations/${var.region}/clusters/dev-cluster"
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
resource "google_clouddeploy_target" "staging" {
|
| 127 |
+
project = google_project.staging.project_id
|
| 128 |
+
name = "staging"
|
| 129 |
+
gke {
|
| 130 |
+
cluster = "projects/${google_project.staging.project_id}/locations/${var.region}/clusters/staging-cluster"
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
resource "google_clouddeploy_target" "prod" {
|
| 135 |
+
project = google_project.prod.project_id
|
| 136 |
+
name = "prod"
|
| 137 |
+
gke {
|
| 138 |
+
cluster = "projects/${google_project.prod.project_id}/locations/${var.region}/clusters/prod-cluster"
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
resource "google_monitoring_alert_policy" "slo_burn_rate" {
|
| 143 |
+
project = google_project.prod.project_id
|
| 144 |
+
display_name = "SLO Burn Rate Alert"
|
| 145 |
+
conditions {
|
| 146 |
+
display_name = "Burn Rate Condition"
|
| 147 |
+
condition_threshold {
|
| 148 |
+
filter = "metric.type=\"compute.googleapis.com/instance/cpu/utilization\""
|
| 149 |
+
comparison = "COMPARISON_GT"
|
| 150 |
+
threshold_value = 0.8
|
| 151 |
+
duration = "60s"
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
notification_channels = [google_cloudfunctions_function.notify_chat.https_trigger_url]
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
resource "google_iam_workload_identity_pool" "github_pool" {
|
| 158 |
+
provider = google-beta
|
| 159 |
+
workload_identity_pool_id = "github-pool"
|
| 160 |
+
display_name = "GitHub Workload Identity Pool"
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
resource "google_iam_workload_identity_pool_provider" "github_provider" {
|
| 164 |
+
provider = google-beta
|
| 165 |
+
workload_identity_pool_id = google_iam_workload_identity_pool.github_pool.workload_identity_pool_id
|
| 166 |
+
workload_identity_pool_provider_id = "github-provider"
|
| 167 |
+
display_name = "GitHub Provider"
|
| 168 |
+
oidc {
|
| 169 |
+
issuer_uri = "https://token.actions.githubusercontent.com"
|
| 170 |
+
}
|
| 171 |
+
attribute_mapping = {
|
| 172 |
+
"google.subject" = "assertion.sub"
|
| 173 |
+
"attribute.actor" = "assertion.actor"
|
| 174 |
+
"attribute.repository" = "assertion.repository"
|
| 175 |
+
}
|
| 176 |
+
attribute_condition = "attribute.repository == 'your-org/your-repo' && attribute.branch == 'main'"
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
resource "google_project_iam_binding" "workload_identity_user" {
|
| 180 |
+
project = google_project.dev.project_id
|
| 181 |
+
role = "roles/iam.workloadIdentityUser"
|
| 182 |
+
members = ["principalSet://iam.googleapis.com/${google_iam_workload_identity_pool.github_pool.name}/attribute.repository/your-org/your-repo"]
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
resource "google_project_iam_binding" "workload_identity_user_staging" {
|
| 186 |
+
project = google_project.staging.project_id
|
| 187 |
+
role = "roles/iam.workloadIdentityUser"
|
| 188 |
+
members = ["principalSet://iam.googleapis.com/${google_iam_workload_identity_pool.github_pool.name}/attribute.repository/your-org/your-repo"]
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
resource "google_project_iam_binding" "workload_identity_user_prod" {
|
| 192 |
+
project = google_project.prod.project_id
|
| 193 |
+
role = "roles/iam.workloadIdentityUser"
|
| 194 |
+
members = ["principalSet://iam.googleapis.com/${google_iam_workload_identity_pool.github_pool.name}/attribute.repository/your-org/your-repo"]
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
resource "google_binary_authorization_policy" "binauthz_policy" {
|
| 198 |
+
project = google_project.prod.project_id
|
| 199 |
+
default_admission_rule {
|
| 200 |
+
evaluation_mode = "ALWAYS_ALLOW"
|
| 201 |
+
enforcement_mode = "ENFORCED_BLOCK_AND_AUDIT_LOG"
|
| 202 |
+
}
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
resource "google_cloudbuild_trigger" "terraform_trigger" {
|
| 206 |
+
project = google_project.dev.project_id
|
| 207 |
+
trigger_template {
|
| 208 |
+
repo_name = "your-infra-repo"
|
| 209 |
+
branch_name = "main"
|
| 210 |
+
}
|
| 211 |
+
build {
|
| 212 |
+
steps {
|
| 213 |
+
name = "hashicorp/terraform"
|
| 214 |
+
args = ["plan"]
|
| 215 |
+
}
|
| 216 |
+
steps {
|
| 217 |
+
name = "hashicorp/terraform"
|
| 218 |
+
args = ["apply", "-auto-approve"]
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
}
|
generated/complex/gpt-4o/complex-gcp-tf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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "google" {
|
| 2 |
+
project = "your-gcp-project-id"
|
| 3 |
+
region = "europe-west1"
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
resource "google_storage_bucket" "data_bucket" {
|
| 7 |
+
name = "gdpr-compliant-bucket"
|
| 8 |
+
location = "eu"
|
| 9 |
+
force_destroy = true
|
| 10 |
+
|
| 11 |
+
lifecycle_rule {
|
| 12 |
+
action {
|
| 13 |
+
type = "Delete"
|
| 14 |
+
}
|
| 15 |
+
condition {
|
| 16 |
+
age = 365
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
resource "google_bigquery_dataset" "dataset" {
|
| 22 |
+
dataset_id = "gdpr_compliant_dataset"
|
| 23 |
+
location = "EU"
|
| 24 |
+
default_table_expiration_ms = 2592000000
|
| 25 |
+
|
| 26 |
+
encryption_configuration {
|
| 27 |
+
kms_key_name = "projects/your-gcp-project-id/locations/europe-west1/keyRings/your-keyring/cryptoKeys/your-key"
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
resource "google_kms_crypto_key" "crypto_key" {
|
| 32 |
+
name = "your-key"
|
| 33 |
+
key_ring = "projects/your-gcp-project-id/locations/europe-west1/keyRings/your-keyring"
|
| 34 |
+
|
| 35 |
+
rotation_period = "2592000s"
|
| 36 |
+
|
| 37 |
+
lifecycle {
|
| 38 |
+
prevent_destroy = false
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
resource "google_sql_database_instance" "postgres_instance" {
|
| 43 |
+
name = "gdpr-compliant-sql"
|
| 44 |
+
database_version = "POSTGRES_13"
|
| 45 |
+
region = "europe-west1"
|
| 46 |
+
|
| 47 |
+
settings {
|
| 48 |
+
tier = "db-custom-1-3840"
|
| 49 |
+
|
| 50 |
+
backup_configuration {
|
| 51 |
+
enabled = true
|
| 52 |
+
point_in_time_recovery_enabled = true
|
| 53 |
+
backup_retention_settings {
|
| 54 |
+
retained_backups = 30
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
ip_configuration {
|
| 59 |
+
ipv4_enabled = false
|
| 60 |
+
private_network = "projects/your-gcp-project-id/global/networks/your-vpc"
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
resource "google_sql_database_instance" "read_replica" {
|
| 66 |
+
name = "gdpr-compliant-sql-replica"
|
| 67 |
+
database_version = "POSTGRES_13"
|
| 68 |
+
region = "europe-west2"
|
| 69 |
+
master_instance_name = google_sql_database_instance.postgres_instance.name
|
| 70 |
+
|
| 71 |
+
settings {
|
| 72 |
+
tier = "db-custom-1-3840"
|
| 73 |
+
|
| 74 |
+
ip_configuration {
|
| 75 |
+
ipv4_enabled = false
|
| 76 |
+
private_network = "projects/your-gcp-project-id/global/networks/your-vpc"
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
resource "google_data_catalog_entry_group" "entry_group" {
|
| 82 |
+
entry_group_id = "gdpr_entry_group"
|
| 83 |
+
location = "europe-west1"
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
resource "google_data_catalog_tag_template" "pii_tag_template" {
|
| 87 |
+
display_name = "PII Tag Template"
|
| 88 |
+
location = "europe-west1"
|
| 89 |
+
fields = {
|
| 90 |
+
"pii_type" = {
|
| 91 |
+
display_name = "PII Type"
|
| 92 |
+
type = {
|
| 93 |
+
primitive_type = "STRING"
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
resource "google_bigquery_table" "authorized_view" {
|
| 100 |
+
dataset_id = google_bigquery_dataset.dataset.dataset_id
|
| 101 |
+
table_id = "authorized_view"
|
| 102 |
+
|
| 103 |
+
view {
|
| 104 |
+
query = "SELECT * FROM your_table WHERE user_id = SESSION_USER()"
|
| 105 |
+
use_legacy_sql = false
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
resource "google_cloud_scheduler_job" "data_deletion_job" {
|
| 110 |
+
name = "data-deletion-job"
|
| 111 |
+
schedule = "0 3 * * *"
|
| 112 |
+
time_zone = "Europe/Brussels"
|
| 113 |
+
|
| 114 |
+
http_target {
|
| 115 |
+
uri = "https://your-cloud-function-url"
|
| 116 |
+
http_method = "POST"
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
resource "google_logging_project_sink" "access_transparency_sink" {
|
| 121 |
+
name = "access-transparency-sink"
|
| 122 |
+
destination = "bigquery.googleapis.com/projects/your-siem-project/datasets/your_dataset"
|
| 123 |
+
|
| 124 |
+
filter = "logName:cloudaudit.googleapis.com%2Factivity"
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
resource "google_vpc_access_connector" "vpc_connector" {
|
| 128 |
+
name = "vpc-connector"
|
| 129 |
+
region = "europe-west1"
|
| 130 |
+
network = "projects/your-gcp-project-id/global/networks/your-vpc"
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
resource "google_access_context_manager_access_policy" "access_policy" {
|
| 134 |
+
parent = "organizations/123456789"
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
resource "google_access_context_manager_access_level" "access_level" {
|
| 138 |
+
name = "access-level"
|
| 139 |
+
parent = google_access_context_manager_access_policy.access_policy.name
|
| 140 |
+
title = "Corporate Devices Only"
|
| 141 |
+
|
| 142 |
+
basic {
|
| 143 |
+
conditions {
|
| 144 |
+
device_policy {
|
| 145 |
+
require_screen_lock = true
|
| 146 |
+
os_constraints {
|
| 147 |
+
os_type = "DESKTOP"
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
resource "google_vpc_service_controls_service_perimeter" "perimeter" {
|
| 155 |
+
name = "service-perimeter"
|
| 156 |
+
perimeter_type = "PERIMETER_TYPE_REGULAR"
|
| 157 |
+
status {
|
| 158 |
+
resources = ["projects/your-gcp-project-id"]
|
| 159 |
+
restricted_services = ["bigquery.googleapis.com", "storage.googleapis.com"]
|
| 160 |
+
|
| 161 |
+
ingress_policies {
|
| 162 |
+
ingress_from {
|
| 163 |
+
identities = ["serviceAccount:your-service-account@your-gcp-project-id.iam.gserviceaccount.com"]
|
| 164 |
+
identity_type = "IDENTITY_TYPE_SERVICE_ACCOUNT"
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
egress_policies {
|
| 169 |
+
egress_to {
|
| 170 |
+
operations {
|
| 171 |
+
service_name = "bigquery.googleapis.com"
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
}
|
generated/complex/gpt-4o/complex-gcp-tf-006/main.tf
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "google" {
|
| 2 |
+
project = "your-gcp-project-id"
|
| 3 |
+
region = "us-central1"
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
resource "google_compute_global_address" "global_ip" {
|
| 7 |
+
name = "global-ip"
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
resource "google_compute_global_forwarding_rule" "global_forwarding_rule" {
|
| 11 |
+
name = "global-forwarding-rule"
|
| 12 |
+
ip_address = google_compute_global_address.global_ip.address
|
| 13 |
+
ip_protocol = "TCP"
|
| 14 |
+
port_range = "80-443"
|
| 15 |
+
target = google_compute_target_http_proxy.http_proxy.self_link
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
resource "google_compute_target_http_proxy" "http_proxy" {
|
| 19 |
+
name = "http-proxy"
|
| 20 |
+
url_map = google_compute_url_map.url_map.self_link
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
resource "google_compute_url_map" "url_map" {
|
| 24 |
+
name = "url-map"
|
| 25 |
+
default_service = google_compute_backend_service.backend_service.self_link
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
resource "google_compute_backend_service" "backend_service" {
|
| 29 |
+
name = "backend-service"
|
| 30 |
+
protocol = "HTTP"
|
| 31 |
+
load_balancing_scheme = "EXTERNAL"
|
| 32 |
+
backends {
|
| 33 |
+
group = google_compute_region_network_endpoint_group.serverless_neg.self_link
|
| 34 |
+
}
|
| 35 |
+
cdn_policy {
|
| 36 |
+
cache_mode = "USE_ORIGIN_HEADERS"
|
| 37 |
+
}
|
| 38 |
+
security_policy = google_compute_security_policy.security_policy.id
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
resource "google_compute_security_policy" "security_policy" {
|
| 42 |
+
name = "security-policy"
|
| 43 |
+
rule {
|
| 44 |
+
action = "allow"
|
| 45 |
+
match {
|
| 46 |
+
versioned_expr = "SRC_IPS_V1"
|
| 47 |
+
config {
|
| 48 |
+
src_ip_ranges = ["0.0.0.0/0"]
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
rule {
|
| 53 |
+
action = "deny(403)"
|
| 54 |
+
match {
|
| 55 |
+
versioned_expr = "SRC_IPS_V1"
|
| 56 |
+
config {
|
| 57 |
+
src_ip_ranges = ["1.2.3.4/32"] # Example IP for geo-blocking
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
resource "google_compute_region_network_endpoint_group" "serverless_neg" {
|
| 64 |
+
name = "serverless-neg"
|
| 65 |
+
network_endpoint_type = "SERVERLESS"
|
| 66 |
+
cloud_run {
|
| 67 |
+
service = google_cloud_run_service.cloud_run_service.name
|
| 68 |
+
}
|
| 69 |
+
region = "us-central1"
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
resource "google_cloud_run_service" "cloud_run_service" {
|
| 73 |
+
name = "cloud-run-service"
|
| 74 |
+
location = "us-central1"
|
| 75 |
+
|
| 76 |
+
template {
|
| 77 |
+
spec {
|
| 78 |
+
containers {
|
| 79 |
+
image = "gcr.io/your-gcp-project-id/your-image"
|
| 80 |
+
resources {
|
| 81 |
+
limits = {
|
| 82 |
+
cpu = "1"
|
| 83 |
+
memory = "512Mi"
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
env {
|
| 87 |
+
name = "SECRET_KEY"
|
| 88 |
+
value = data.google_secret_manager_secret_version.secret_version.secret_data
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
service_account_name = google_service_account.cloud_run_service_account.email
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
traffic {
|
| 96 |
+
percent = 100
|
| 97 |
+
latest_revision = true
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
resource "google_service_account" "cloud_run_service_account" {
|
| 102 |
+
account_id = "cloud-run-sa"
|
| 103 |
+
display_name = "Cloud Run Service Account"
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
resource "google_secret_manager_secret" "secret" {
|
| 107 |
+
secret_id = "my-secret"
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
data "google_secret_manager_secret_version" "secret_version" {
|
| 111 |
+
secret = google_secret_manager_secret.secret.secret_id
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
resource "google_vpc_access_connector" "vpc_connector" {
|
| 115 |
+
name = "vpc-connector"
|
| 116 |
+
region = "us-central1"
|
| 117 |
+
network = "default"
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
resource "google_cloud_sql_instance" "cloud_sql_instance" {
|
| 121 |
+
name = "cloud-sql-instance"
|
| 122 |
+
database_version = "POSTGRES_13"
|
| 123 |
+
region = "us-central1"
|
| 124 |
+
settings {
|
| 125 |
+
tier = "db-f1-micro"
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
resource "google_redis_instance" "redis_instance" {
|
| 130 |
+
name = "redis-instance"
|
| 131 |
+
tier = "BASIC"
|
| 132 |
+
memory_size_gb = 1
|
| 133 |
+
region = "us-central1"
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
resource "google_firebase_project" "firebase" {
|
| 137 |
+
project = "your-gcp-project-id"
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
resource "google_identity_platform_config" "identity_platform" {
|
| 141 |
+
project = "your-gcp-project-id"
|
| 142 |
+
mfa {
|
| 143 |
+
state = "ENABLED"
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
resource "google_cloud_tasks_queue" "tasks_queue" {
|
| 148 |
+
name = "tasks-queue"
|
| 149 |
+
location = "us-central1"
|
| 150 |
+
rate_limits {
|
| 151 |
+
max_dispatches_per_second = 5
|
| 152 |
+
}
|
| 153 |
+
retry_config {
|
| 154 |
+
max_attempts = 5
|
| 155 |
+
}
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
resource "google_monitoring_slo" "slo" {
|
| 159 |
+
display_name = "Availability SLO"
|
| 160 |
+
goal = 0.99
|
| 161 |
+
rolling_period = "30d"
|
| 162 |
+
service {
|
| 163 |
+
service_id = "my-service"
|
| 164 |
+
}
|
| 165 |
+
request_based {
|
| 166 |
+
good_total_ratio {
|
| 167 |
+
good_service_filter = "metric.type=\"serviceruntime.googleapis.com/api/request_count\" AND metric.label.\"response_code\" < 400"
|
| 168 |
+
total_service_filter = "metric.type=\"serviceruntime.googleapis.com/api/request_count\""
|
| 169 |
+
}
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
resource "google_monitoring_alert_policy" "burn_rate_alert" {
|
| 174 |
+
display_name = "Burn Rate Alert"
|
| 175 |
+
conditions {
|
| 176 |
+
display_name = "Burn Rate Condition"
|
| 177 |
+
condition_threshold {
|
| 178 |
+
filter = "metric.type=\"serviceruntime.googleapis.com/api/request_count\" AND metric.label.\"response_code\" >= 400"
|
| 179 |
+
comparison = "COMPARISON_GT"
|
| 180 |
+
threshold_value = 0.05
|
| 181 |
+
duration = "300s"
|
| 182 |
+
aggregations {
|
| 183 |
+
alignment_period = "60s"
|
| 184 |
+
per_series_aligner = "ALIGN_RATE"
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
combiner = "OR"
|
| 189 |
+
notification_channels = ["projects/your-gcp-project-id/notificationChannels/your-channel-id"]
|
| 190 |
+
}
|
generated/complex/gpt-4o/complex-gcp-tf-007/main.tf
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "google" {
|
| 2 |
+
project = "your-gcp-project-id"
|
| 3 |
+
region = "us-central1"
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
resource "google_compute_network" "shared_services_vpc" {
|
| 7 |
+
name = "shared-services-vpc"
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
resource "google_compute_router" "cloud_router" {
|
| 11 |
+
name = "cloud-router"
|
| 12 |
+
network = google_compute_network.shared_services_vpc.name
|
| 13 |
+
bgp {
|
| 14 |
+
asn = 64512
|
| 15 |
+
}
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
resource "google_compute_interconnect_attachment" "primary_interconnect" {
|
| 19 |
+
name = "primary-interconnect"
|
| 20 |
+
interconnect = "your-primary-interconnect-id"
|
| 21 |
+
router = google_compute_router.cloud_router.name
|
| 22 |
+
edge_availability_domain = "availability-domain-1"
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
resource "google_compute_interconnect_attachment" "secondary_interconnect" {
|
| 26 |
+
name = "secondary-interconnect"
|
| 27 |
+
interconnect = "your-secondary-interconnect-id"
|
| 28 |
+
router = google_compute_router.cloud_router.name
|
| 29 |
+
edge_availability_domain = "availability-domain-2"
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
resource "google_compute_interconnect_attachment" "partner_interconnect" {
|
| 33 |
+
name = "partner-interconnect"
|
| 34 |
+
interconnect = "your-partner-interconnect-id"
|
| 35 |
+
router = google_compute_router.cloud_router.name
|
| 36 |
+
type = "PARTNER"
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
resource "google_network_connectivity_hub" "ncc_hub" {
|
| 40 |
+
name = "network-connectivity-hub"
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
resource "google_network_connectivity_spoke" "primary_spoke" {
|
| 44 |
+
name = "primary-spoke"
|
| 45 |
+
hub = google_network_connectivity_hub.ncc_hub.id
|
| 46 |
+
linked_interconnect_attachments = [google_compute_interconnect_attachment.primary_interconnect.id]
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
resource "google_network_connectivity_spoke" "secondary_spoke" {
|
| 50 |
+
name = "secondary-spoke"
|
| 51 |
+
hub = google_network_connectivity_hub.ncc_hub.id
|
| 52 |
+
linked_interconnect_attachments = [google_compute_interconnect_attachment.secondary_interconnect.id]
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
resource "google_network_connectivity_spoke" "partner_spoke" {
|
| 56 |
+
name = "partner-spoke"
|
| 57 |
+
hub = google_network_connectivity_hub.ncc_hub.id
|
| 58 |
+
linked_interconnect_attachments = [google_compute_interconnect_attachment.partner_interconnect.id]
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
resource "google_dns_managed_zone" "forwarding_zone" {
|
| 62 |
+
name = "on-prem-dns"
|
| 63 |
+
dns_name = "onprem.example.com."
|
| 64 |
+
visibility = "private"
|
| 65 |
+
forwarding_config {
|
| 66 |
+
target_name_servers {
|
| 67 |
+
ipv4_address = "on-prem-dns-server-ip"
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
resource "google_dns_managed_zone" "peering_zone" {
|
| 73 |
+
name = "cross-project-dns"
|
| 74 |
+
dns_name = "crossproject.example.com."
|
| 75 |
+
visibility = "private"
|
| 76 |
+
peering_config {
|
| 77 |
+
target_network {
|
| 78 |
+
network_url = "projects/other-project/global/networks/other-vpc"
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
resource "google_private_service_connect_endpoint" "psc_google_apis" {
|
| 84 |
+
name = "psc-google-apis"
|
| 85 |
+
network = google_compute_network.shared_services_vpc.name
|
| 86 |
+
target_service = "all-apis"
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
resource "google_compute_security_policy" "cloud_armor_policy" {
|
| 90 |
+
name = "cloud-armor-policy"
|
| 91 |
+
rule {
|
| 92 |
+
action = "allow"
|
| 93 |
+
match {
|
| 94 |
+
versioned_expr = "SRC_IPS_V1"
|
| 95 |
+
config {
|
| 96 |
+
src_ip_ranges = ["0.0.0.0/0"]
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
resource "google_pubsub_topic" "threat_detection_topic" {
|
| 103 |
+
name = "threat-detection-topic"
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
resource "google_pubsub_subscription" "chronicle_siem_subscription" {
|
| 107 |
+
name = "chronicle-siem-subscription"
|
| 108 |
+
topic = google_pubsub_topic.threat_detection_topic.id
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
resource "google_cloud_ids_endpoint" "cloud_ids" {
|
| 112 |
+
name = "cloud-ids-instance"
|
| 113 |
+
network = google_compute_network.shared_services_vpc.name
|
| 114 |
+
threat_detection {
|
| 115 |
+
pubsub_topic = google_pubsub_topic.threat_detection_topic.id
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
resource "google_network_management_connectivity_test" "connectivity_test" {
|
| 120 |
+
name = "connectivity-test"
|
| 121 |
+
source {
|
| 122 |
+
instance = "projects/your-gcp-project-id/zones/us-central1-a/instances/source-instance"
|
| 123 |
+
}
|
| 124 |
+
destination {
|
| 125 |
+
instance = "projects/your-gcp-project-id/zones/us-central1-a/instances/destination-instance"
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
resource "google_network_management_firewall_insights" "firewall_insights" {
|
| 130 |
+
name = "firewall-insights"
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
resource "google_network_management_performance_dashboard" "performance_dashboard" {
|
| 134 |
+
name = "performance-dashboard"
|
| 135 |
+
monitored_resources {
|
| 136 |
+
resource_type = "INTERCONNECT"
|
| 137 |
+
resource_id = google_compute_interconnect_attachment.primary_interconnect.id
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
resource "google_compute_firewall_policy" "hierarchical_policy" {
|
| 142 |
+
name = "hierarchical-firewall-policy"
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
resource "google_compute_firewall_policy_rule" "allow_traffic" {
|
| 146 |
+
policy = google_compute_firewall_policy.hierarchical_policy.id
|
| 147 |
+
action = "allow"
|
| 148 |
+
match {
|
| 149 |
+
layer4_configs {
|
| 150 |
+
ip_protocol = "tcp"
|
| 151 |
+
ports = ["0-65535"]
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
direction = "INGRESS"
|
| 155 |
+
priority = 1000
|
| 156 |
+
target_service_accounts = ["serviceAccount:your-service-account@your-gcp-project-id.iam.gserviceaccount.com"]
|
| 157 |
+
}
|
generated/complex/gpt-4o/complex-gcp-tf-008/main.tf
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "google" {
|
| 2 |
+
project = "your-gcp-project-id"
|
| 3 |
+
region = "us-central1"
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
resource "google_compute_network" "vpc_network" {
|
| 7 |
+
name = "mlops-vpc"
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
resource "google_compute_subnetwork" "private_subnet" {
|
| 11 |
+
name = "mlops-private-subnet"
|
| 12 |
+
ip_cidr_range = "10.0.0.0/24"
|
| 13 |
+
region = "us-central1"
|
| 14 |
+
network = google_compute_network.vpc_network.id
|
| 15 |
+
private_ip_google_access = true
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
resource "google_kms_key_ring" "mlops_key_ring" {
|
| 19 |
+
name = "mlops-key-ring"
|
| 20 |
+
location = "us-central1"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
resource "google_kms_crypto_key" "mlops_crypto_key" {
|
| 24 |
+
name = "mlops-crypto-key"
|
| 25 |
+
key_ring = google_kms_key_ring.mlops_key_ring.id
|
| 26 |
+
rotation_period = "100000s"
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
resource "google_vertex_ai_workbench_instance" "vertex_ai_workbench" {
|
| 30 |
+
name = "mlops-workbench"
|
| 31 |
+
machine_type = "n1-standard-4"
|
| 32 |
+
subnet = google_compute_subnetwork.private_subnet.id
|
| 33 |
+
kms_key = google_kms_crypto_key.mlops_crypto_key.id
|
| 34 |
+
enable_ip_forwarding = false
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
resource "google_vertex_ai_featurestore" "feature_store" {
|
| 38 |
+
name = "mlops-feature-store"
|
| 39 |
+
online_serving_config {
|
| 40 |
+
fixed_node_count = 1
|
| 41 |
+
}
|
| 42 |
+
bigquery_destination {
|
| 43 |
+
output_uri = "bq://your-gcp-project-id.dataset.table"
|
| 44 |
+
}
|
| 45 |
+
bigtable_destination {
|
| 46 |
+
instance_id = "bigtable-instance"
|
| 47 |
+
table_id = "bigtable-table"
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
resource "google_vertex_ai_endpoint" "vertex_ai_endpoint" {
|
| 52 |
+
display_name = "mlops-endpoint"
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
resource "google_vertex_ai_model" "vertex_ai_model" {
|
| 56 |
+
display_name = "mlops-model"
|
| 57 |
+
container_spec {
|
| 58 |
+
image_uri = "gcr.io/your-gcp-project-id/custom-container"
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
resource "google_vertex_ai_pipeline" "vertex_ai_pipeline" {
|
| 63 |
+
display_name = "mlops-pipeline"
|
| 64 |
+
pipeline_spec = file("pipeline_spec.json")
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
resource "google_vertex_ai_tensorboard" "vertex_ai_tensorboard" {
|
| 68 |
+
display_name = "mlops-tensorboard"
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
resource "google_vertex_ai_custom_job" "vertex_ai_custom_job" {
|
| 72 |
+
display_name = "mlops-custom-job"
|
| 73 |
+
job_spec {
|
| 74 |
+
worker_pool_specs {
|
| 75 |
+
machine_spec {
|
| 76 |
+
machine_type = "a2-highgpu-1g"
|
| 77 |
+
accelerator_type = "NVIDIA_TESLA_A100"
|
| 78 |
+
accelerator_count = 1
|
| 79 |
+
}
|
| 80 |
+
container_spec {
|
| 81 |
+
image_uri = "gcr.io/your-gcp-project-id/custom-container"
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
resource "google_cloud_run_service" "cloud_deploy_service" {
|
| 88 |
+
name = "mlops-cloud-deploy"
|
| 89 |
+
location = "us-central1"
|
| 90 |
+
template {
|
| 91 |
+
spec {
|
| 92 |
+
containers {
|
| 93 |
+
image = "gcr.io/your-gcp-project-id/deploy-container"
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
resource "google_iam_policy" "vertex_ai_iam_policy" {
|
| 100 |
+
binding {
|
| 101 |
+
role = "roles/aiplatform.user"
|
| 102 |
+
members = [
|
| 103 |
+
"serviceAccount:your-service-account@your-gcp-project-id.iam.gserviceaccount.com"
|
| 104 |
+
]
|
| 105 |
+
condition {
|
| 106 |
+
title = "DeploymentWindow"
|
| 107 |
+
description = "Allow deployments only during approved windows"
|
| 108 |
+
expression = "request.time.getHours('America/Los_Angeles') >= 9 && request.time.getHours('America/Los_Angeles') <= 17"
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
resource "google_vertex_ai_model_deployment" "model_deployment" {
|
| 114 |
+
model = google_vertex_ai_model.vertex_ai_model.id
|
| 115 |
+
endpoint = google_vertex_ai_endpoint.vertex_ai_endpoint.id
|
| 116 |
+
traffic_split {
|
| 117 |
+
0 = 50
|
| 118 |
+
1 = 50
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
resource "google_vertex_ai_featurestore_entitytype" "featurestore_entitytype" {
|
| 123 |
+
featurestore = google_vertex_ai_featurestore.feature_store.id
|
| 124 |
+
entitytype_id = "entity-type-id"
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
resource "google_vertex_ai_featurestore_entitytype_feature" "featurestore_feature" {
|
| 128 |
+
featurestore_entitytype = google_vertex_ai_featurestore_entitytype.featurestore_entitytype.id
|
| 129 |
+
feature_id = "feature-id"
|
| 130 |
+
value_type = "STRING"
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
resource "google_dataflow_job" "dataflow_job" {
|
| 134 |
+
name = "mlops-dataflow-job"
|
| 135 |
+
template_gcs_path = "gs://your-bucket/templates/dataflow-template"
|
| 136 |
+
parameters = {
|
| 137 |
+
inputFile = "gs://your-bucket/input-file"
|
| 138 |
+
outputTable = "your-gcp-project-id:dataset.output_table"
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
resource "google_binary_authorization_attestor" "binary_authorization" {
|
| 143 |
+
name = "mlops-attestor"
|
| 144 |
+
attestation_authority_note {
|
| 145 |
+
note_reference = "projects/your-gcp-project-id/notes/note-id"
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
resource "google_workload_identity_pool" "workload_identity_pool" {
|
| 150 |
+
provider_id = "mlops-workload-identity"
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
resource "google_workload_identity_pool_provider" "workload_identity_provider" {
|
| 154 |
+
workload_identity_pool_id = google_workload_identity_pool.workload_identity_pool.id
|
| 155 |
+
provider_id = "mlops-provider"
|
| 156 |
+
oidc {
|
| 157 |
+
issuer_uri = "https://accounts.google.com"
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
resource "google_vertex_ai_model_monitoring_job" "model_monitoring" {
|
| 162 |
+
display_name = "mlops-model-monitoring"
|
| 163 |
+
model_deployment = google_vertex_ai_model_deployment.model_deployment.id
|
| 164 |
+
objective_config {
|
| 165 |
+
training_dataset {
|
| 166 |
+
bigquery_source {
|
| 167 |
+
input_uri = "bq://your-gcp-project-id.dataset.training_table"
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
prediction_dataset {
|
| 171 |
+
bigquery_source {
|
| 172 |
+
input_uri = "bq://your-gcp-project-id.dataset.prediction_table"
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
}
|
generated/complex/gpt-4o/complex-gcp-tf-009/main.tf
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "google" {
|
| 2 |
+
project = "your-gcp-project-id"
|
| 3 |
+
region = "us-central1"
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
resource "google_container_cluster" "gke_cluster" {
|
| 7 |
+
count = 3
|
| 8 |
+
name = "gke-cluster-${count.index}"
|
| 9 |
+
location = ["us-central1", "europe-west1", "asia-east1"][count.index]
|
| 10 |
+
initial_node_count = 1
|
| 11 |
+
|
| 12 |
+
node_config {
|
| 13 |
+
machine_type = "custom-4-16384"
|
| 14 |
+
shielded_instance_config {
|
| 15 |
+
enable_secure_boot = true
|
| 16 |
+
enable_integrity_monitoring = true
|
| 17 |
+
}
|
| 18 |
+
confidential_nodes {
|
| 19 |
+
enabled = true
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
datapath_provider = "ADVANCED_DATAPATH"
|
| 24 |
+
enable_autopilot = false
|
| 25 |
+
|
| 26 |
+
network_policy {
|
| 27 |
+
enabled = true
|
| 28 |
+
provider = "CILIUM"
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
node_pool {
|
| 32 |
+
name = "auto-provisioned-pool"
|
| 33 |
+
management {
|
| 34 |
+
auto_upgrade = true
|
| 35 |
+
}
|
| 36 |
+
autoscaling {
|
| 37 |
+
min_node_count = 1
|
| 38 |
+
max_node_count = 5
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
logging_service = "logging.googleapis.com/kubernetes"
|
| 43 |
+
monitoring_service = "monitoring.googleapis.com/kubernetes"
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
resource "google_gke_hub_membership" "gke_membership" {
|
| 47 |
+
count = 3
|
| 48 |
+
name = "gke-cluster-${count.index}"
|
| 49 |
+
endpoint {
|
| 50 |
+
gke_cluster {
|
| 51 |
+
resource_link = google_container_cluster.gke_cluster[count.index].self_link
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
resource "google_gke_hub_membership" "bare_metal_membership" {
|
| 57 |
+
name = "bare-metal-cluster"
|
| 58 |
+
endpoint {
|
| 59 |
+
bare_metal {
|
| 60 |
+
admin_cluster {
|
| 61 |
+
membership_cr_manifest = file("path/to/bare-metal-membership.yaml")
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
resource "google_gke_hub_feature" "config_management" {
|
| 68 |
+
name = "config-management"
|
| 69 |
+
spec {
|
| 70 |
+
configmanagement {
|
| 71 |
+
policy_controller {
|
| 72 |
+
enabled = true
|
| 73 |
+
template_library_installed = true
|
| 74 |
+
}
|
| 75 |
+
config_sync {
|
| 76 |
+
git {
|
| 77 |
+
sync_repo = "https://github.com/your-org/your-repo"
|
| 78 |
+
sync_branch = "main"
|
| 79 |
+
policy_dir = "config-sync"
|
| 80 |
+
secret_type = "ssh"
|
| 81 |
+
}
|
| 82 |
+
prevent_drift = true
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
resource "google_gke_hub_feature" "service_mesh" {
|
| 89 |
+
name = "service-mesh"
|
| 90 |
+
spec {
|
| 91 |
+
servicemesh {
|
| 92 |
+
control_plane = "MANAGED"
|
| 93 |
+
mtls {
|
| 94 |
+
mode = "STRICT"
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
resource "google_gke_hub_feature" "multi_cluster_ingress" {
|
| 101 |
+
name = "multi-cluster-ingress"
|
| 102 |
+
spec {
|
| 103 |
+
multiclusteringress {
|
| 104 |
+
config_membership = google_gke_hub_membership.gke_membership[0].name
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
resource "google_logging_project_sink" "fleet_logging" {
|
| 110 |
+
name = "fleet-logging"
|
| 111 |
+
destination = "logging.googleapis.com/projects/your-gcp-project-id/locations/global/buckets/_Default"
|
| 112 |
+
filter = "resource.type=gke_cluster"
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
resource "google_monitoring_notification_channel" "fleet_monitoring" {
|
| 116 |
+
display_name = "Fleet Monitoring"
|
| 117 |
+
type = "email"
|
| 118 |
+
labels = {
|
| 119 |
+
email_address = "your-email@example.com"
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
resource "google_iam_policy" "fleet_rbac" {
|
| 124 |
+
binding {
|
| 125 |
+
role = "roles/gkehub.admin"
|
| 126 |
+
members = [
|
| 127 |
+
"group:your-group@example.com"
|
| 128 |
+
]
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
resource "google_iap_tunnel_instance_iam_member" "connect_gateway" {
|
| 133 |
+
project = "your-gcp-project-id"
|
| 134 |
+
zone = "us-central1-a"
|
| 135 |
+
instance = google_container_cluster.gke_cluster[0].name
|
| 136 |
+
role = "roles/iap.tunnelResourceAccessor"
|
| 137 |
+
member = "user:your-email@example.com"
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
resource "google_logging_project_sink" "audit_logging" {
|
| 141 |
+
name = "audit-logging"
|
| 142 |
+
destination = "logging.googleapis.com/projects/your-gcp-project-id/locations/global/buckets/_Default"
|
| 143 |
+
fil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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "google" {
|
| 2 |
+
project = var.project_id
|
| 3 |
+
region = var.region
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
resource "google_project" "data_product" {
|
| 7 |
+
name = var.data_product_name
|
| 8 |
+
project_id = var.data_product_id
|
| 9 |
+
org_id = var.organization_id
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
resource "google_bigquery_dataset" "dataset" {
|
| 13 |
+
project = google_project.data_product.project_id
|
| 14 |
+
dataset_id = var.dataset_id
|
| 15 |
+
location = var.region
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
resource "google_dataplex_lake" "lake" {
|
| 19 |
+
project = google_project.data_product.project_id
|
| 20 |
+
location = var.region
|
| 21 |
+
lake_id = var.lake_id
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
resource "google_dataplex_zone" "zone" {
|
| 25 |
+
project = google_project.data_product.project_id
|
| 26 |
+
location = var.region
|
| 27 |
+
lake = google_dataplex_lake.lake.name
|
| 28 |
+
zone_id = var.zone_id
|
| 29 |
+
type = "RAW"
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
resource "google_dataplex_task" "data_quality" {
|
| 33 |
+
project = google_project.data_product.project_id
|
| 34 |
+
location = var.region
|
| 35 |
+
lake = google_dataplex_lake.lake.name
|
| 36 |
+
task_id = var.data_quality_task_id
|
| 37 |
+
|
| 38 |
+
execution_spec {
|
| 39 |
+
service_account = var.service_account_email
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
trigger_spec {
|
| 43 |
+
type = "ON_DEMAND"
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
notebook {
|
| 47 |
+
path = var.notebook_path
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
resource "google_analytics_hub_data_exchange" "data_exchange" {
|
| 52 |
+
project = google_project.data_product.project_id
|
| 53 |
+
location = var.region
|
| 54 |
+
data_exchange_id = var.data_exchange_id
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
resource "google_data_catalog_entry_group" "entry_group" {
|
| 58 |
+
project = google_project.data_product.project_id
|
| 59 |
+
location = var.region
|
| 60 |
+
entry_group_id = var.entry_group_id
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
resource "google_data_catalog_tag_template" "tag_template" {
|
| 64 |
+
project = google_project.data_product.project_id
|
| 65 |
+
location = var.region
|
| 66 |
+
tag_template_id = var.tag_template_id
|
| 67 |
+
|
| 68 |
+
field {
|
| 69 |
+
display_name = "Business Metadata"
|
| 70 |
+
type {
|
| 71 |
+
primitive_type = "STRING"
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
resource "google_composer_environment" "composer" {
|
| 77 |
+
project = google_project.data_product.project_id
|
| 78 |
+
region = var.region
|
| 79 |
+
name = var.composer_name
|
| 80 |
+
|
| 81 |
+
config {
|
| 82 |
+
node_count = 3
|
| 83 |
+
software_config {
|
| 84 |
+
image_version = "composer-2.0.0-airflow-2.1.0"
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
resource "google_pubsub_topic" "cdc_topic" {
|
| 90 |
+
project = google_project.data_product.project_id
|
| 91 |
+
name = var.cdc_topic_name
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
resource "google_cloudfunctions_function" "api_function" {
|
| 95 |
+
project = google_project.data_product.project_id
|
| 96 |
+
name = var.api_function_name
|
| 97 |
+
runtime = "nodejs14"
|
| 98 |
+
entry_point = "main"
|
| 99 |
+
source_archive_bucket = var.source_bucket
|
| 100 |
+
source_archive_object = var.source_object
|
| 101 |
+
|
| 102 |
+
trigger_http = true
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
resource "google_api_gateway_api" "api_gateway" {
|
| 106 |
+
project = google_project.data_product.project_id
|
| 107 |
+
api_id = var.api_id
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
resource "google_api_gateway_api_config" "api_config" {
|
| 111 |
+
project = google_project.data_product.project_id
|
| 112 |
+
api = google_api_gateway_api.api_gateway.api_id
|
| 113 |
+
config_id = var.api_config_id
|
| 114 |
+
|
| 115 |
+
openapi_documents {
|
| 116 |
+
document {
|
| 117 |
+
path = var.openapi_spec_path
|
| 118 |
+
contents = file(var.openapi_spec_file)
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
resource "google_api_gateway_gateway" "gateway" {
|
| 124 |
+
project = google_project.data_product.project_id
|
| 125 |
+
api = google_api_gateway_api.api_gateway.api_id
|
| 126 |
+
gateway_id = var.gateway_id
|
| 127 |
+
api_config = google_api_gateway_api_config.api_config.id
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
resource "google_data_catalog_policy_tag" "org_policy" {
|
| 131 |
+
project = var.organization_project_id
|
| 132 |
+
location = var.region
|
| 133 |
+
taxonomy = var.taxonomy_id
|
| 134 |
+
display_name = "Organization Level Policy"
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
resource "google_data_loss_prevention_inspect_template" "dlp_template" {
|
| 138 |
+
project = var.organization_project_id
|
| 139 |
+
inspect_template_id = var.dlp_template_id
|
| 140 |
+
|
| 141 |
+
inspect_config {
|
| 142 |
+
info_types {
|
| 143 |
+
name = "EMAIL_ADDRESS"
|
| 144 |
+
}
|
| 145 |
+
min_likelihood = "POSSIBLE"
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
resource "google_security_center_notification_config" "scc_notification" {
|
| 150 |
+
project = var.organization_project_id
|
| 151 |
+
notification_config_id = var.scc_notification_id
|
| 152 |
+
pubsub_topic = google_pubsub_topic.cdc_topic.id
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
module "data_product_module" {
|
| 156 |
+
source = "app.terraform.io/my-org/data-product-module"
|
| 157 |
+
version = "1.0.0"
|
| 158 |
+
|
| 159 |
+
project_id = google_project.data_product.project_id
|
| 160 |
+
region = var.region
|
| 161 |
+
dataset_id = google_bigquery_dataset.dataset.dataset_id
|
| 162 |
+
lake_id = google_dataplex_lake.lake.lake_id
|
| 163 |
+
zone_id = google_dataplex_zone.zone.zone_id
|
| 164 |
+
api_id = google_api_gateway_api.api_gateway.api_id
|
| 165 |
+
}
|
generated/complex/gpt-4o/complex-k8s-tf-001/main.tf
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "kubernetes" {
|
| 2 |
+
config_path = "~/.kube/config"
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
provider "helm" {
|
| 6 |
+
kubernetes {
|
| 7 |
+
config_path = "~/.kube/config"
|
| 8 |
+
}
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
provider "aws" {
|
| 12 |
+
region = "us-west-2"
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
resource "kubernetes_namespace" "monitoring" {
|
| 16 |
+
metadata {
|
| 17 |
+
name = "monitoring"
|
| 18 |
+
labels = {
|
| 19 |
+
"pod-security.kubernetes.io/enforce" = "restricted"
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
resource "kubernetes_network_policy" "monitoring" {
|
| 25 |
+
metadata {
|
| 26 |
+
name = "monitoring-network-policy"
|
| 27 |
+
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
| 28 |
+
}
|
| 29 |
+
spec {
|
| 30 |
+
pod_selector {}
|
| 31 |
+
policy_types = ["Ingress"]
|
| 32 |
+
ingress {
|
| 33 |
+
from {
|
| 34 |
+
pod_selector {
|
| 35 |
+
match_labels = {
|
| 36 |
+
"app.kubernetes.io/name" = "prometheus"
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
ports {
|
| 41 |
+
port = 9090
|
| 42 |
+
protocol = "TCP"
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
resource "helm_release" "cert_manager" {
|
| 49 |
+
name = "cert-manager"
|
| 50 |
+
namespace = "cert-manager"
|
| 51 |
+
repository = "https://charts.jetstack.io"
|
| 52 |
+
chart = "cert-manager"
|
| 53 |
+
version = "v1.8.0"
|
| 54 |
+
|
| 55 |
+
set {
|
| 56 |
+
name = "installCRDs"
|
| 57 |
+
value = "true"
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
resource "kubernetes_manifest" "letsencrypt_cluster_issuers" {
|
| 62 |
+
manifest = {
|
| 63 |
+
"apiVersion" = "cert-manager.io/v1"
|
| 64 |
+
"kind" = "ClusterIssuer"
|
| 65 |
+
"metadata" = {
|
| 66 |
+
"name" = "letsencrypt-staging"
|
| 67 |
+
}
|
| 68 |
+
"spec" = {
|
| 69 |
+
"acme" = {
|
| 70 |
+
"server" = "https://acme-staging-v02.api.letsencrypt.org/directory"
|
| 71 |
+
"email" = "your-email@example.com"
|
| 72 |
+
"privateKeySecretRef" = {
|
| 73 |
+
"name" = "letsencrypt-staging"
|
| 74 |
+
}
|
| 75 |
+
"solvers" = [
|
| 76 |
+
{
|
| 77 |
+
"dns01" = {
|
| 78 |
+
"route53" = {
|
| 79 |
+
"region" = "us-west-2"
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
]
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
resource "helm_release" "nginx_ingress" {
|
| 90 |
+
name = "nginx-ingress"
|
| 91 |
+
namespace = "ingress-nginx"
|
| 92 |
+
repository = "https://kubernetes.github.io/ingress-nginx"
|
| 93 |
+
chart = "ingress-nginx"
|
| 94 |
+
version = "4.0.6"
|
| 95 |
+
|
| 96 |
+
set {
|
| 97 |
+
name = "controller.config.enable-modsecurity"
|
| 98 |
+
value = "true"
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
set {
|
| 102 |
+
name = "controller.config.modsecurity-snippet"
|
| 103 |
+
value = "Include /etc/nginx/owasp-modsecurity-crs/nginx-modsecurity.conf"
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
resource "helm_release" "external_dns" {
|
| 108 |
+
name = "external-dns"
|
| 109 |
+
namespace = "kube-system"
|
| 110 |
+
repository = "https://charts.bitnami.com/bitnami"
|
| 111 |
+
chart = "external-dns"
|
| 112 |
+
version = "5.4.0"
|
| 113 |
+
|
| 114 |
+
set {
|
| 115 |
+
name = "provider"
|
| 116 |
+
value = "aws"
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
set {
|
| 120 |
+
name = "txtOwnerId"
|
| 121 |
+
value = "external-dns"
|
| 122 |
+
}
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
resource "helm_release" "prometheus_stack" {
|
| 126 |
+
name = "kube-prometheus-stack"
|
| 127 |
+
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
| 128 |
+
repository = "https://prometheus-community.github.io/helm-charts"
|
| 129 |
+
chart = "kube-prometheus-stack"
|
| 130 |
+
version = "19.0.0"
|
| 131 |
+
|
| 132 |
+
set {
|
| 133 |
+
name = "prometheus.thanos.create"
|
| 134 |
+
value = "true"
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
set {
|
| 138 |
+
name = "prometheus.thanos.objectStorageConfig"
|
| 139 |
+
value = <<EOF
|
| 140 |
+
type: S3
|
| 141 |
+
config:
|
| 142 |
+
bucket: "thanos-bucket"
|
| 143 |
+
endpoint: "s3.amazonaws.com"
|
| 144 |
+
access_key: "your-access-key"
|
| 145 |
+
secret_key: "your-secret-key"
|
| 146 |
+
EOF
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
resource "helm_release" "grafana" {
|
| 151 |
+
name = "grafana"
|
| 152 |
+
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
| 153 |
+
repository = "https://grafana.github.io/helm-charts"
|
| 154 |
+
chart = "grafana"
|
| 155 |
+
version = "6.17.0"
|
| 156 |
+
|
| 157 |
+
set {
|
| 158 |
+
name = "grafana.ini.auth.generic_oauth"
|
| 159 |
+
value = <<EOF
|
| 160 |
+
enabled = true
|
| 161 |
+
name = OAuth
|
| 162 |
+
allow_sign_up = true
|
| 163 |
+
client_id = your-client-id
|
| 164 |
+
client_secret = your-client-secret
|
| 165 |
+
scopes = openid email profile
|
| 166 |
+
auth_url = https://dex.example.com/auth
|
| 167 |
+
token_url = https://dex.example.com/token
|
| 168 |
+
api_url = https://dex.example.com/userinfo
|
| 169 |
+
EOF
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
resource "helm_release" "loki" {
|
| 174 |
+
name = "loki"
|
| 175 |
+
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
| 176 |
+
repository = "https://grafana.github.io/helm-charts"
|
| 177 |
+
chart = "loki"
|
| 178 |
+
version = "2.9.0"
|
| 179 |
+
|
| 180 |
+
set {
|
| 181 |
+
name = "loki.config.storage_config.aws_s3"
|
| 182 |
+
value = <<EOF
|
| 183 |
+
bucketnames: "loki-bucket"
|
| 184 |
+
region: "us-west-2"
|
| 185 |
+
EOF
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
set {
|
| 189 |
+
name = "loki.config.auth_enabled"
|
| 190 |
+
value = "true"
|
| 191 |
+
}
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
resource "helm_release" "tempo" {
|
| 195 |
+
name = "tempo"
|
| 196 |
+
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
| 197 |
+
repository = "https://grafana.github.io/helm-charts"
|
| 198 |
+
chart = "tempo"
|
| 199 |
+
version = "0.7.0"
|
| 200 |
+
|
| 201 |
+
set {
|
| 202 |
+
name = "tempo.config.receivers.jaeger"
|
| 203 |
+
value = "true"
|
| 204 |
+
}
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
resource "helm_release" "velero" {
|
| 208 |
+
name = "velero"
|
| 209 |
+
namespace = "velero"
|
| 210 |
+
repository = "https://vmware-tanzu.github.io/helm-charts"
|
| 211 |
+
chart = "velero"
|
| 212 |
+
version = "2.23.0"
|
| 213 |
+
|
| 214 |
+
set {
|
| 215 |
+
name = "configuration.provider"
|
| 216 |
+
value = "aws"
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
set {
|
| 220 |
+
name = "configuration.backupStorageLocation.bucket"
|
| 221 |
+
value = "velero-backups"
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
set {
|
| 225 |
+
name = "configuration.backupStorageLocation.config.region"
|
| 226 |
+
value = "us-west-2"
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
set {
|
| 230 |
+
name = "configuration.backupStorageLocation.config.s3ForcePathStyle"
|
| 231 |
+
value = "true"
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
set {
|
| 235 |
+
name = "configuration.backupStorageLocation.config.s3Url"
|
| 236 |
+
value = "https://s3.amazonaws.com"
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
set {
|
| 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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: v1
|
| 2 |
+
kind: Namespace
|
| 3 |
+
metadata:
|
| 4 |
+
name: tenant-root
|
| 5 |
+
---
|
| 6 |
+
apiVersion: hnc.x-k8s.io/v1alpha2
|
| 7 |
+
kind: HierarchyConfiguration
|
| 8 |
+
metadata:
|
| 9 |
+
name: hierarchy
|
| 10 |
+
namespace: tenant-root
|
| 11 |
+
spec:
|
| 12 |
+
children:
|
| 13 |
+
- dev
|
| 14 |
+
- staging
|
| 15 |
+
- prod
|
| 16 |
+
---
|
| 17 |
+
apiVersion: kyverno.io/v1
|
| 18 |
+
kind: ClusterPolicy
|
| 19 |
+
metadata:
|
| 20 |
+
name: enforce-approved-registries
|
| 21 |
+
spec:
|
| 22 |
+
rules:
|
| 23 |
+
- name: validate-image-registry
|
| 24 |
+
match:
|
| 25 |
+
resources:
|
| 26 |
+
kinds:
|
| 27 |
+
- Pod
|
| 28 |
+
validate:
|
| 29 |
+
message: "Images must be pulled from approved registries"
|
| 30 |
+
pattern:
|
| 31 |
+
spec:
|
| 32 |
+
containers:
|
| 33 |
+
- image: "approved-registry.com/*"
|
| 34 |
+
---
|
| 35 |
+
apiVersion: kyverno.io/v1
|
| 36 |
+
kind: ClusterPolicy
|
| 37 |
+
metadata:
|
| 38 |
+
name: enforce-image-signature
|
| 39 |
+
spec:
|
| 40 |
+
rules:
|
| 41 |
+
- name: verify-image-signature
|
| 42 |
+
match:
|
| 43 |
+
resources:
|
| 44 |
+
kinds:
|
| 45 |
+
- Pod
|
| 46 |
+
verifyImages:
|
| 47 |
+
- image: "approved-registry.com/*"
|
| 48 |
+
key: "cosign.pub"
|
| 49 |
+
---
|
| 50 |
+
apiVersion: kyverno.io/v1
|
| 51 |
+
kind: ClusterPolicy
|
| 52 |
+
metadata:
|
| 53 |
+
name: inject-resource-quotas
|
| 54 |
+
spec:
|
| 55 |
+
rules:
|
| 56 |
+
- name: add-resource-quotas
|
| 57 |
+
match:
|
| 58 |
+
resources:
|
| 59 |
+
kinds:
|
| 60 |
+
- Namespace
|
| 61 |
+
mutate:
|
| 62 |
+
patchStrategicMerge:
|
| 63 |
+
spec:
|
| 64 |
+
resourceQuota:
|
| 65 |
+
hard:
|
| 66 |
+
requests.cpu: "1"
|
| 67 |
+
requests.memory: "1Gi"
|
| 68 |
+
limits.cpu: "2"
|
| 69 |
+
limits.memory: "2Gi"
|
| 70 |
+
---
|
| 71 |
+
apiVersion: kyverno.io/v1
|
| 72 |
+
kind: ClusterPolicy
|
| 73 |
+
metadata:
|
| 74 |
+
name: inject-limit-ranges
|
| 75 |
+
spec:
|
| 76 |
+
rules:
|
| 77 |
+
- name: add-limit-ranges
|
| 78 |
+
match:
|
| 79 |
+
resources:
|
| 80 |
+
kinds:
|
| 81 |
+
- Namespace
|
| 82 |
+
mutate:
|
| 83 |
+
patchStrategicMerge:
|
| 84 |
+
spec:
|
| 85 |
+
limitRange:
|
| 86 |
+
limits:
|
| 87 |
+
- default:
|
| 88 |
+
cpu: "500m"
|
| 89 |
+
memory: "256Mi"
|
| 90 |
+
defaultRequest:
|
| 91 |
+
cpu: "250m"
|
| 92 |
+
memory: "128Mi"
|
| 93 |
+
---
|
| 94 |
+
apiVersion: kyverno.io/v1
|
| 95 |
+
kind: ClusterPolicy
|
| 96 |
+
metadata:
|
| 97 |
+
name: enforce-security-context
|
| 98 |
+
spec:
|
| 99 |
+
rules:
|
| 100 |
+
- name: add-security-context
|
| 101 |
+
match:
|
| 102 |
+
resources:
|
| 103 |
+
kinds:
|
| 104 |
+
- Pod
|
| 105 |
+
mutate:
|
| 106 |
+
patchStrategicMerge:
|
| 107 |
+
spec:
|
| 108 |
+
securityContext:
|
| 109 |
+
runAsNonRoot: true
|
| 110 |
+
readOnlyRootFilesystem: true
|
| 111 |
+
capabilities:
|
| 112 |
+
drop: ["ALL"]
|
| 113 |
+
---
|
| 114 |
+
apiVersion: networking.k8s.io/v1
|
| 115 |
+
kind: NetworkPolicy
|
| 116 |
+
metadata:
|
| 117 |
+
name: default-deny
|
| 118 |
+
namespace: tenant-root
|
| 119 |
+
spec:
|
| 120 |
+
podSelector: {}
|
| 121 |
+
policyTypes:
|
| 122 |
+
- Ingress
|
| 123 |
+
- Egress
|
| 124 |
+
ingress:
|
| 125 |
+
- from:
|
| 126 |
+
- podSelector: {}
|
| 127 |
+
egress:
|
| 128 |
+
- to:
|
| 129 |
+
- podSelector: {}
|
| 130 |
+
---
|
| 131 |
+
apiVersion: apiextensions.crossplane.io/v1
|
| 132 |
+
kind: Composition
|
| 133 |
+
metadata:
|
| 134 |
+
name: rds-instance
|
| 135 |
+
spec:
|
| 136 |
+
compositeTypeRef:
|
| 137 |
+
apiVersion: database.example.org/v1alpha1
|
| 138 |
+
kind: RDSInstance
|
| 139 |
+
resources:
|
| 140 |
+
- name: instance
|
| 141 |
+
base:
|
| 142 |
+
apiVersion: database.aws.crossplane.io/v1beta1
|
| 143 |
+
kind: RDSInstance
|
| 144 |
+
spec:
|
| 145 |
+
forProvider:
|
| 146 |
+
region: us-west-2
|
| 147 |
+
---
|
| 148 |
+
apiVersion: apiextensions.crossplane.io/v1
|
| 149 |
+
kind: Composition
|
| 150 |
+
metadata:
|
| 151 |
+
name: s3-bucket
|
| 152 |
+
spec:
|
| 153 |
+
compositeTypeRef:
|
| 154 |
+
apiVersion: storage.example.org/v1alpha1
|
| 155 |
+
kind: S3Bucket
|
| 156 |
+
resources:
|
| 157 |
+
- name: bucket
|
| 158 |
+
base:
|
| 159 |
+
apiVersion: s3.aws.crossplane.io/v1beta1
|
| 160 |
+
kind: Bucket
|
| 161 |
+
spec:
|
| 162 |
+
forProvider:
|
| 163 |
+
region: us-west-2
|
| 164 |
+
---
|
| 165 |
+
apiVersion: templates.gatekeeper.sh/v1beta1
|
| 166 |
+
kind: ConstraintTemplate
|
| 167 |
+
metadata:
|
| 168 |
+
name: k8sdisallowpublic
|
| 169 |
+
spec:
|
| 170 |
+
crd:
|
| 171 |
+
spec:
|
| 172 |
+
names:
|
| 173 |
+
kind: K8sDisallowPublic
|
| 174 |
+
targets:
|
| 175 |
+
- target: admission.k8s.gatekeeper.sh
|
| 176 |
+
rego: |
|
| 177 |
+
package k8sdisallowpublic
|
| 178 |
+
violation[{"msg": msg}] {
|
| 179 |
+
input.review.object.spec.forProvider.publicAccessBlockConfiguration.blockPublicAcls == false
|
| 180 |
+
msg := "Public access is not allowed"
|
| 181 |
+
}
|
| 182 |
+
---
|
| 183 |
+
apiVersion: bitnami.com/v1alpha1
|
| 184 |
+
kind: SealedSecret
|
| 185 |
+
metadata:
|
| 186 |
+
name: mysecret
|
| 187 |
+
namespace: tenant-root
|
| 188 |
+
spec:
|
| 189 |
+
encryptedData:
|
| 190 |
+
foo: AgB+...
|
| 191 |
+
template:
|
| 192 |
+
metadata:
|
| 193 |
+
labels:
|
| 194 |
+
app: myapp
|
| 195 |
+
---
|
| 196 |
+
apiVersion: argoproj.io/v1alpha1
|
| 197 |
+
kind: ApplicationSet
|
| 198 |
+
metadata:
|
| 199 |
+
name: tenants
|
| 200 |
+
spec:
|
| 201 |
+
generators:
|
| 202 |
+
- git:
|
| 203 |
+
repoURL: https://github.com/example/tenants
|
| 204 |
+
directory:
|
| 205 |
+
recurse: true
|
| 206 |
+
template:
|
| 207 |
+
metadata:
|
| 208 |
+
name: '{{path.basename}}'
|
| 209 |
+
spec:
|
| 210 |
+
project: '{{path.basename}}'
|
| 211 |
+
source:
|
| 212 |
+
repoURL: https://github.com/example/tenants
|
| 213 |
+
path: '{{path}}'
|
| 214 |
+
targetRevision: HEAD
|
| 215 |
+
destination:
|
| 216 |
+
server: https://kubernetes.default.svc
|
| 217 |
+
namespace: '{{path.basename}}'
|
| 218 |
+
---
|
| 219 |
+
apiVersion: rbac.authorization.k8s.io/v1
|
| 220 |
+
kind: Role
|
| 221 |
+
metadata:
|
| 222 |
+
namespace: tenant-root
|
| 223 |
+
name: tenant-admin
|
| 224 |
+
rules:
|
| 225 |
+
- apiGroups: [""]
|
| 226 |
+
resources: ["pods", "services", "deployments"]
|
| 227 |
+
verbs: ["get", "list", "watch", "create", "update", "delete"]
|
| 228 |
+
---
|
| 229 |
+
apiVersion: rbac.authorization.k8s.io/v1
|
| 230 |
+
kind: RoleBinding
|
| 231 |
+
metadata:
|
| 232 |
+
name: tenant-admin-binding
|
| 233 |
+
namespace: tenant-root
|
| 234 |
+
roleRef:
|
| 235 |
+
apiGroup: rbac.authorization.k8s.io
|
| 236 |
+
kind: Role
|
| 237 |
+
name: tenant-admin
|
| 238 |
+
subjects:
|
| 239 |
+
- kind: User
|
| 240 |
+
name: tenant-user
|
| 241 |
+
apiGroup: rbac.authorization.k8s.io
|
generated/complex/gpt-4o/complex-k8s-tf-003/main.yaml
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: linkerd.io/v1alpha2
|
| 2 |
+
kind: ServiceProfile
|
| 3 |
+
metadata:
|
| 4 |
+
name: my-service.default.svc.cluster.local
|
| 5 |
+
spec:
|
| 6 |
+
routes:
|
| 7 |
+
- name: "/api/v1"
|
| 8 |
+
condition:
|
| 9 |
+
method: GET
|
| 10 |
+
isRetryable: true
|
| 11 |
+
responseClasses:
|
| 12 |
+
- condition:
|
| 13 |
+
status:
|
| 14 |
+
min: 500
|
| 15 |
+
max: 599
|
| 16 |
+
isFailure: true
|
| 17 |
+
---
|
| 18 |
+
apiVersion: split.smi-spec.io/v1alpha2
|
| 19 |
+
kind: TrafficSplit
|
| 20 |
+
metadata:
|
| 21 |
+
name: my-service-split
|
| 22 |
+
spec:
|
| 23 |
+
service: my-service
|
| 24 |
+
backends:
|
| 25 |
+
- service: my-service-primary
|
| 26 |
+
weight: 90
|
| 27 |
+
- service: my-service-canary
|
| 28 |
+
weight: 10
|
| 29 |
+
---
|
| 30 |
+
apiVersion: policy.linkerd.io/v1alpha1
|
| 31 |
+
kind: AuthorizationPolicy
|
| 32 |
+
metadata:
|
| 33 |
+
name: my-service-authz
|
| 34 |
+
spec:
|
| 35 |
+
targetRef:
|
| 36 |
+
kind: ServiceAccount
|
| 37 |
+
name: my-service-account
|
| 38 |
+
rules:
|
| 39 |
+
- from:
|
| 40 |
+
- source:
|
| 41 |
+
kind: ServiceAccount
|
| 42 |
+
name: allowed-service-account
|
| 43 |
+
---
|
| 44 |
+
apiVersion: linkerd.io/v1alpha1
|
| 45 |
+
kind: LinkerdViz
|
| 46 |
+
metadata:
|
| 47 |
+
name: linkerd-viz
|
| 48 |
+
spec:
|
| 49 |
+
prometheus:
|
| 50 |
+
enabled: true
|
| 51 |
+
grafana:
|
| 52 |
+
enabled: true
|
| 53 |
+
---
|
| 54 |
+
apiVersion: linkerd.io/v1alpha1
|
| 55 |
+
kind: LinkerdJaeger
|
| 56 |
+
metadata:
|
| 57 |
+
name: linkerd-jaeger
|
| 58 |
+
spec:
|
| 59 |
+
tracing:
|
| 60 |
+
enabled: true
|
| 61 |
+
---
|
| 62 |
+
apiVersion: getambassador.io/v2
|
| 63 |
+
kind: Host
|
| 64 |
+
metadata:
|
| 65 |
+
name: my-host
|
| 66 |
+
spec:
|
| 67 |
+
hostname: my-service.example.com
|
| 68 |
+
acmeProvider:
|
| 69 |
+
authority: https://acme-v02.api.letsencrypt.org/directory
|
| 70 |
+
tlsSecret:
|
| 71 |
+
name: my-tls-secret
|
| 72 |
+
requestPolicy:
|
| 73 |
+
insecure:
|
| 74 |
+
action: Redirect
|
| 75 |
+
cors:
|
| 76 |
+
origins:
|
| 77 |
+
- "*"
|
| 78 |
+
methods:
|
| 79 |
+
- GET
|
| 80 |
+
- POST
|
| 81 |
+
headers:
|
| 82 |
+
- Content-Type
|
| 83 |
+
---
|
| 84 |
+
apiVersion: getambassador.io/v2
|
| 85 |
+
kind: RateLimitService
|
| 86 |
+
metadata:
|
| 87 |
+
name: rate-limit
|
| 88 |
+
spec:
|
| 89 |
+
service: redis-rate-limit.default:6379
|
| 90 |
+
timeout_ms: 1000
|
| 91 |
+
---
|
| 92 |
+
apiVersion: getambassador.io/v2
|
| 93 |
+
kind: Mapping
|
| 94 |
+
metadata:
|
| 95 |
+
name: my-service-mapping
|
| 96 |
+
spec:
|
| 97 |
+
prefix: /api/
|
| 98 |
+
service: my-service.default.svc.cluster.local
|
| 99 |
+
host: my-service.example.com
|
| 100 |
+
cors:
|
| 101 |
+
origins:
|
| 102 |
+
- "*"
|
| 103 |
+
methods:
|
| 104 |
+
- GET
|
| 105 |
+
- POST
|
| 106 |
+
headers:
|
| 107 |
+
- Content-Type
|
| 108 |
+
rate_limits:
|
| 109 |
+
- descriptor_key: client_ip
|
| 110 |
+
rate: 1000
|
| 111 |
+
unit: minute
|
| 112 |
+
ext_auth:
|
| 113 |
+
enabled: true
|
| 114 |
+
auth_service: oauth2-proxy.default:4180
|
| 115 |
+
---
|
| 116 |
+
apiVersion: linkerd.io/v1alpha1
|
| 117 |
+
kind: LinkerdMulticluster
|
| 118 |
+
metadata:
|
| 119 |
+
name: linkerd-multicluster
|
| 120 |
+
spec:
|
| 121 |
+
gateways:
|
| 122 |
+
- name: cluster1-gateway
|
| 123 |
+
- name: cluster2-gateway
|
| 124 |
+
- name: cluster3-gateway
|
| 125 |
+
serviceMirroring:
|
| 126 |
+
enabled: true
|
| 127 |
+
endpointVerification:
|
| 128 |
+
enabled: true
|
generated/complex/gpt-4o/complex-k8s-tf-004/main.tf
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "kubernetes" {
|
| 2 |
+
config_path = "~/.kube/config"
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
resource "kubernetes_namespace" "tekton" {
|
| 6 |
+
metadata {
|
| 7 |
+
name = "tekton"
|
| 8 |
+
}
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
resource "kubernetes_namespace" "tekton-triggers" {
|
| 12 |
+
metadata {
|
| 13 |
+
name = "tekton-triggers"
|
| 14 |
+
}
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
resource "kubernetes_namespace" "tekton-chains" {
|
| 18 |
+
metadata {
|
| 19 |
+
name = "tekton-chains"
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
resource "kubernetes_namespace" "tekton-dashboard" {
|
| 24 |
+
metadata {
|
| 25 |
+
name = "tekton-dashboard"
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
resource "kubernetes_namespace" "tekton-results" {
|
| 30 |
+
metadata {
|
| 31 |
+
name = "tekton-results"
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
resource "kubernetes_namespace" "tekton-monitoring" {
|
| 36 |
+
metadata {
|
| 37 |
+
name = "tekton-monitoring"
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
resource "kubernetes_namespace" "tekton-pipelines" {
|
| 42 |
+
metadata {
|
| 43 |
+
name = "tekton-pipelines"
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
resource "kubernetes_namespace" "argo-cd" {
|
| 48 |
+
metadata {
|
| 49 |
+
name = "argo-cd"
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
resource "kubernetes_network_policy" "tekton_network_policy" {
|
| 54 |
+
metadata {
|
| 55 |
+
name = "default-deny"
|
| 56 |
+
namespace = "tekton"
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
spec {
|
| 60 |
+
pod_selector {}
|
| 61 |
+
|
| 62 |
+
policy_types = ["Ingress", "Egress"]
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
resource "kubernetes_service_account" "tekton_pipelines" {
|
| 67 |
+
metadata {
|
| 68 |
+
name = "tekton-pipelines"
|
| 69 |
+
namespace = "tekton-pipelines"
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
resource "kubernetes_role_binding" "tekton_pipelines" {
|
| 74 |
+
metadata {
|
| 75 |
+
name = "tekton-pipelines"
|
| 76 |
+
namespace = "tekton-pipelines"
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
role_ref {
|
| 80 |
+
api_group = "rbac.authorization.k8s.io"
|
| 81 |
+
kind = "ClusterRole"
|
| 82 |
+
name = "tekton-pipelines-controller"
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
subjects {
|
| 86 |
+
kind = "ServiceAccount"
|
| 87 |
+
name = kubernetes_service_account.tekton_pipelines.metadata[0].name
|
| 88 |
+
namespace = kubernetes_service_account.tekton_pipelines.metadata[0].namespace
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
resource "kubernetes_deployment" "tekton_pipelines" {
|
| 93 |
+
metadata {
|
| 94 |
+
name = "tekton-pipelines-controller"
|
| 95 |
+
namespace = "tekton-pipelines"
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
spec {
|
| 99 |
+
replicas = 1
|
| 100 |
+
|
| 101 |
+
selector {
|
| 102 |
+
match_labels = {
|
| 103 |
+
app = "tekton-pipelines-controller"
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
template {
|
| 108 |
+
metadata {
|
| 109 |
+
labels = {
|
| 110 |
+
app = "tekton-pipelines-controller"
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
spec {
|
| 115 |
+
service_account_name = kubernetes_service_account.tekton_pipelines.metadata[0].name
|
| 116 |
+
|
| 117 |
+
containers {
|
| 118 |
+
name = "tekton-pipelines-controller"
|
| 119 |
+
image = "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller:v0.30.0"
|
| 120 |
+
|
| 121 |
+
security_context {
|
| 122 |
+
run_as_user = 1000
|
| 123 |
+
run_as_group = 3000
|
| 124 |
+
fs_group = 2000
|
| 125 |
+
}
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
resource "kubernetes_service" "tekton_dashboard" {
|
| 133 |
+
metadata {
|
| 134 |
+
name = "tekton-dashboard"
|
| 135 |
+
namespace = "tekton-dashboard"
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
spec {
|
| 139 |
+
selector = {
|
| 140 |
+
app = "tekton-dashboard"
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
ports {
|
| 144 |
+
port = 9097
|
| 145 |
+
target_port = 9097
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
resource "kubernetes_ingress" "tekton_dashboard" {
|
| 151 |
+
metadata {
|
| 152 |
+
name = "tekton-dashboard"
|
| 153 |
+
namespace = "tekton-dashboard"
|
| 154 |
+
annotations = {
|
| 155 |
+
"nginx.ingress.kubernetes.io/whitelist-source-range" = "192.168.1.0/24"
|
| 156 |
+
"nginx.ingress.kubernetes.io/auth-url" = "https://auth.example.com/oauth2/auth"
|
| 157 |
+
"nginx.ingress.kubernetes.io/auth-signin" = "https://auth.example.com/oauth2/start?rd=$request_uri"
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
spec {
|
| 162 |
+
rules {
|
| 163 |
+
host = "tekton-dashboard.example.com"
|
| 164 |
+
|
| 165 |
+
http {
|
| 166 |
+
paths {
|
| 167 |
+
path = "/"
|
| 168 |
+
|
| 169 |
+
backend {
|
| 170 |
+
service_name = kubernetes_service.tekton_dashboard.metadata[0].name
|
| 171 |
+
service_port = 9097
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
resource "kubernetes_secret" "github_webhook_secret" {
|
| 180 |
+
metadata {
|
| 181 |
+
name = "github-webhook-secret"
|
| 182 |
+
namespace = "tekton-triggers"
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
data = {
|
| 186 |
+
secret = base64encode("your-github-webhook-secret")
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
resource "kubernetes_config_map" "tekton_triggers_eventlistener" {
|
| 191 |
+
metadata {
|
| 192 |
+
name = "tekton-triggers-eventlistener"
|
| 193 |
+
namespace = "tekton-triggers"
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
data = {
|
| 197 |
+
"eventlistener.yaml" = <<EOF
|
| 198 |
+
apiVersion: triggers.tekton.dev/v1alpha1
|
| 199 |
+
kind: EventListener
|
| 200 |
+
metadata:
|
| 201 |
+
name: github-listener
|
| 202 |
+
spec:
|
| 203 |
+
serviceAccountName: tekton-triggers
|
| 204 |
+
triggers:
|
| 205 |
+
- name: github-trigger
|
| 206 |
+
interceptors:
|
| 207 |
+
- ref:
|
| 208 |
+
name: "github"
|
| 209 |
+
params:
|
| 210 |
+
- name: secretRef
|
| 211 |
+
value:
|
| 212 |
+
secretKey: secret
|
| 213 |
+
secretName: github-webhook-secret
|
| 214 |
+
bindings:
|
| 215 |
+
- ref: pipeline-binding
|
| 216 |
+
template:
|
| 217 |
+
ref: pipeline-template
|
| 218 |
+
EOF
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
resource "kubernetes_secret" "cosign_kms_key" {
|
| 223 |
+
metadata {
|
| 224 |
+
name = "cosign-kms-key"
|
| 225 |
+
namespace = "tekton-pipelines"
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
data = {
|
| 229 |
+
key = base64encode("your-kms-key")
|
| 230 |
+
}
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
resource "kubernetes_config_map" "tekton_pipeline" {
|
| 234 |
+
metadata {
|
| 235 |
+
name = "tekton-pipeline"
|
| 236 |
+
namespace = "tekton-pipelines"
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
data = {
|
| 240 |
+
"pipeline.yaml" = <<EOF
|
| 241 |
+
apiVersion: tekton.dev/v1beta1
|
| 242 |
+
kind: Pipeline
|
| 243 |
+
metadata:
|
| 244 |
+
name: image-build-pipeline
|
| 245 |
+
spec:
|
| 246 |
+
tasks:
|
| 247 |
+
- name: git-clone
|
| 248 |
+
taskRef:
|
| 249 |
+
name: git-clone
|
| 250 |
+
- name: build-image
|
| 251 |
+
taskRef:
|
| 252 |
+
name: buildah
|
| 253 |
+
params:
|
| 254 |
+
- name: IMAGE
|
| 255 |
+
value: "$(params.image-url)"
|
| 256 |
+
- name: scan-image
|
| 257 |
+
taskRef:
|
| 258 |
+
name: trivy
|
| 259 |
+
params:
|
| 260 |
+
- name: IMAGE
|
| 261 |
+
value: "$(tasks.build-image.results.image)"
|
| 262 |
+
- name: sign-image
|
| 263 |
+
taskRef:
|
| 264 |
+
name: cosign
|
| 265 |
+
params:
|
| 266 |
+
- name: IMAGE
|
| 267 |
+
value: "$(tasks.build-image.results.image)"
|
| 268 |
+
- name: KMS_KEY
|
| 269 |
+
valueFrom:
|
| 270 |
+
secretKeyRef:
|
| 271 |
+
name: cosign-kms-key
|
| 272 |
+
key: key
|
| 273 |
+
- name: validate-manifests
|
| 274 |
+
taskRef:
|
| 275 |
+
name: conftest
|
| 276 |
+
params:
|
| 277 |
+
- name: MANIFESTS
|
| 278 |
+
value: "$(tasks.build-image.results.manifests)"
|
| 279 |
+
- name: deploy
|
| 280 |
+
taskRef:
|
| 281 |
+
name: argocd-sync
|
| 282 |
+
params:
|
| 283 |
+
- name: APP
|
| 284 |
+
value: "$(params.app-name)"
|
| 285 |
+
EOF
|
| 286 |
+
}
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
resource "kubernetes_config_map" "tekton_results_config" {
|
| 290 |
+
metadata {
|
| 291 |
+
name = "tekton-results-config"
|
| 292 |
+
namespace = "tekton-results"
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
data = {
|
| 296 |
+
"config.yaml" = <<EOF
|
| 297 |
+
database:
|
| 298 |
+
user: "results"
|
| 299 |
+
password: "results-password"
|
| 300 |
+
host: "postgresql"
|
| 301 |
+
port: 5432
|
| 302 |
+
dbname: "tekton_results"
|
| 303 |
+
EOF
|
| 304 |
+
}
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
resource "kubernetes_cron_job" "pipeline_run_cleanup" {
|
| 308 |
+
metadata {
|
| 309 |
+
name = "pipeline-run-cleanup"
|
| 310 |
+
namespace = "tekton-pipelines"
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
spec {
|
| 314 |
+
schedule = "0 0 * * *"
|
| 315 |
+
|
| 316 |
+
job_template {
|
| 317 |
+
spec {
|
| 318 |
+
template {
|
| 319 |
+
spec {
|
| 320 |
+
containers {
|
| 321 |
+
name = "cleanup"
|
| 322 |
+
image = "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/pipelinerun-cleanup:v0.30.0"
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
restart_policy = "OnFailure"
|
| 326 |
+
}
|
| 327 |
+
}
|
| 328 |
+
}
|
| 329 |
+
}
|
| 330 |
+
}
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
resource "kubernetes_service_monitor" "tekton_pipelines" {
|
| 334 |
+
metadata {
|
| 335 |
+
name = "tekton-pipelines"
|
| 336 |
+
namespace = "tekton-monitoring"
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
spec {
|
| 340 |
+
selector {
|
| 341 |
+
match_labels = {
|
| 342 |
+
app = "tekton-pipelines-controller"
|
| 343 |
+
}
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
endpoints {
|
| 347 |
+
port = "metrics"
|
| 348 |
+
}
|
| 349 |
+
}
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
resource "kubernetes_config_map" "grafana_dashboard" {
|
| 353 |
+
metadata {
|
| 354 |
+
name = "tekton-dashboard"
|
| 355 |
+
namespace = "tekton-monitoring"
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
data = {
|
| 359 |
+
"dashboard.json" = <<EOF
|
| 360 |
+
{
|
| 361 |
+
"dashboard": {
|
| 362 |
+
"panels": [
|
| 363 |
+
{
|
| 364 |
+
"title": "Build Success Rate",
|
| 365 |
+
"type": "graph",
|
| 366 |
+
"targets": [
|
| 367 |
+
{
|
| 368 |
+
"expr": "sum(rate(tekton_pipelines_builds_success[5m])) / sum(rate(tekton_pipelines_builds_total[5m]))",
|
| 369 |
+
"format": "time_series"
|
| 370 |
+
}
|
| 371 |
+
]
|
| 372 |
+
},
|
| 373 |
+
{
|
| 374 |
+
"title": "Build Duration",
|
| 375 |
+
"type": "graph",
|
| 376 |
+
"targets": [
|
| 377 |
+
{
|
| 378 |
+
"expr": "histogram_quantile(0.95, sum(rate(tekton_pipelines_build_duration_seconds_bucket[5m])) by (le))",
|
| 379 |
+
"format": "time_series"
|
| 380 |
+
}
|
| 381 |
+
]
|
| 382 |
+
},
|
| 383 |
+
{
|
| 384 |
+
"title": "Vulnerability Trends",
|
| 385 |
+
"type": "graph",
|
| 386 |
+
"targets": [
|
| 387 |
+
{
|
| 388 |
+
"expr": "sum(rate(trivy_vulnerabilities_total[5m])) by (severity)",
|
| 389 |
+
"format": "time_series"
|
| 390 |
+
}
|
| 391 |
+
]
|
| 392 |
+
}
|
| 393 |
+
]
|
| 394 |
+
}
|
| 395 |
+
}
|
| 396 |
+
EOF
|
| 397 |
+
}
|
| 398 |
+
}
|
generated/complex/gpt-4o/complex-k8s-tf-005/main.yaml
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: cockroachlabs.com/v1alpha1
|
| 2 |
+
kind: CrdbCluster
|
| 3 |
+
metadata:
|
| 4 |
+
name: cockroachdb
|
| 5 |
+
spec:
|
| 6 |
+
nodes: 9
|
| 7 |
+
regions:
|
| 8 |
+
- name: region-a
|
| 9 |
+
nodes: 3
|
| 10 |
+
- name: region-b
|
| 11 |
+
nodes: 3
|
| 12 |
+
- name: region-c
|
| 13 |
+
nodes: 3
|
| 14 |
+
tls:
|
| 15 |
+
enabled: true
|
| 16 |
+
certManagerIssuer: "letsencrypt-prod"
|
| 17 |
+
locality:
|
| 18 |
+
partitioning: "gdpr"
|
| 19 |
+
backup:
|
| 20 |
+
schedule: "0 2 * * *"
|
| 21 |
+
storage:
|
| 22 |
+
type: "s3"
|
| 23 |
+
s3:
|
| 24 |
+
bucket: "cockroachdb-backups"
|
| 25 |
+
region: "us-west-1"
|
| 26 |
+
podAntiAffinity: true
|
| 27 |
+
topologySpreadConstraints:
|
| 28 |
+
- maxSkew: 1
|
| 29 |
+
topologyKey: "topology.kubernetes.io/zone"
|
| 30 |
+
podDisruptionBudget:
|
| 31 |
+
maxUnavailable: 1
|
| 32 |
+
storage:
|
| 33 |
+
className: "gp2-encrypted"
|
| 34 |
+
volumeExpansion: true
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
apiVersion: kafka.strimzi.io/v1beta2
|
| 38 |
+
kind: Kafka
|
| 39 |
+
metadata:
|
| 40 |
+
name: kafka-cluster
|
| 41 |
+
spec:
|
| 42 |
+
kafka:
|
| 43 |
+
version: "3.0.0"
|
| 44 |
+
replicas: 3
|
| 45 |
+
listeners:
|
| 46 |
+
- name: tls
|
| 47 |
+
port: 9093
|
| 48 |
+
type: internal
|
| 49 |
+
tls: true
|
| 50 |
+
authentication:
|
| 51 |
+
type: scram-sha-512
|
| 52 |
+
authorization:
|
| 53 |
+
type: simple
|
| 54 |
+
storage:
|
| 55 |
+
type: jbod
|
| 56 |
+
volumes:
|
| 57 |
+
- id: 0
|
| 58 |
+
type: persistent-claim
|
| 59 |
+
size: 100Gi
|
| 60 |
+
class: "gp2-encrypted"
|
| 61 |
+
deleteClaim: false
|
| 62 |
+
config:
|
| 63 |
+
offsets.topic.replication.factor: 3
|
| 64 |
+
transaction.state.log.replication.factor: 3
|
| 65 |
+
transaction.state.log.min.isr: 2
|
| 66 |
+
log.message.format.version: "3.0"
|
| 67 |
+
podDisruptionBudget:
|
| 68 |
+
maxUnavailable: 1
|
| 69 |
+
podAntiAffinity: true
|
| 70 |
+
topologySpreadConstraints:
|
| 71 |
+
- maxSkew: 1
|
| 72 |
+
topologyKey: "topology.kubernetes.io/zone"
|
| 73 |
+
zookeeper:
|
| 74 |
+
replicas: 3
|
| 75 |
+
storage:
|
| 76 |
+
type: persistent-claim
|
| 77 |
+
size: 100Gi
|
| 78 |
+
class: "gp2-encrypted"
|
| 79 |
+
deleteClaim: false
|
| 80 |
+
entityOperator:
|
| 81 |
+
topicOperator: {}
|
| 82 |
+
userOperator: {}
|
| 83 |
+
kafkaMirrorMaker2:
|
| 84 |
+
replicas: 3
|
| 85 |
+
connectCluster: "target-cluster"
|
| 86 |
+
consumer:
|
| 87 |
+
config:
|
| 88 |
+
group.id: "mirror-maker-consumer"
|
| 89 |
+
producer:
|
| 90 |
+
config:
|
| 91 |
+
acks: "all"
|
| 92 |
+
cruiseControl:
|
| 93 |
+
config:
|
| 94 |
+
num.partition.replicas: 3
|
| 95 |
+
|
| 96 |
+
---
|
| 97 |
+
apiVersion: redis.redis.opstreelabs.in/v1beta1
|
| 98 |
+
kind: RedisSentinel
|
| 99 |
+
metadata:
|
| 100 |
+
name: redis-sentinel
|
| 101 |
+
spec:
|
| 102 |
+
size: 3
|
| 103 |
+
redis:
|
| 104 |
+
image: "redis:6.2"
|
| 105 |
+
storage:
|
| 106 |
+
type: persistent-claim
|
| 107 |
+
size: 10Gi
|
| 108 |
+
class: "gp2-encrypted"
|
| 109 |
+
volumeExpansion: true
|
| 110 |
+
tls:
|
| 111 |
+
enabled: true
|
| 112 |
+
certManagerIssuer: "letsencrypt-prod"
|
| 113 |
+
acl:
|
| 114 |
+
enabled: true
|
| 115 |
+
sentinel:
|
| 116 |
+
replicas: 3
|
| 117 |
+
podDisruptionBudget:
|
| 118 |
+
maxUnavailable: 1
|
| 119 |
+
podAntiAffinity: true
|
| 120 |
+
topologySpreadConstraints:
|
| 121 |
+
- maxSkew: 1
|
| 122 |
+
topologyKey: "topology.kubernetes.io/zone"
|
| 123 |
+
backup:
|
| 124 |
+
schedule: "0 3 * * *"
|
| 125 |
+
storage:
|
| 126 |
+
type: "s3"
|
| 127 |
+
s3:
|
| 128 |
+
bucket: "redis-backups"
|
| 129 |
+
region: "us-west-1"
|
generated/complex/gpt-4o/complex-k8s-tf-006/main.tf
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "helm" {
|
| 2 |
+
kubernetes {
|
| 3 |
+
config_path = "~/.kube/config"
|
| 4 |
+
}
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
provider "aws" {
|
| 8 |
+
region = "us-west-2"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
resource "helm_release" "vault" {
|
| 12 |
+
name = "vault"
|
| 13 |
+
namespace = "vault"
|
| 14 |
+
chart = "hashicorp/vault"
|
| 15 |
+
repository = "https://helm.releases.hashicorp.com"
|
| 16 |
+
|
| 17 |
+
values = [
|
| 18 |
+
<<EOF
|
| 19 |
+
server:
|
| 20 |
+
ha:
|
| 21 |
+
enabled: true
|
| 22 |
+
dataStorage:
|
| 23 |
+
enabled: true
|
| 24 |
+
storageClass: "encrypted-storage-class"
|
| 25 |
+
auditStorage:
|
| 26 |
+
enabled: true
|
| 27 |
+
storageClass: "audit-storage-class"
|
| 28 |
+
extraEnvironmentVars:
|
| 29 |
+
VAULT_AUDIT_LOG_PATH: "/vault/logs/audit.log"
|
| 30 |
+
VAULT_AUDIT_LOG_FORWARDER: "loki"
|
| 31 |
+
extraVolumes:
|
| 32 |
+
- name: audit-log
|
| 33 |
+
persistentVolumeClaim:
|
| 34 |
+
claimName: audit-log-pvc
|
| 35 |
+
extraVolumeMounts:
|
| 36 |
+
- name: audit-log
|
| 37 |
+
mountPath: /vault/logs
|
| 38 |
+
extraArgs:
|
| 39 |
+
- "-auto-unseal"
|
| 40 |
+
- "-seal=awskms"
|
| 41 |
+
- "-seal-config=region=us-west-2"
|
| 42 |
+
- "-seal-config=kms_key_id=your-kms-key-id"
|
| 43 |
+
- "-seal-config=access_key=your-access-key"
|
| 44 |
+
- "-seal-config=secret_key=your-secret-key"
|
| 45 |
+
injector:
|
| 46 |
+
enabled: true
|
| 47 |
+
EOF
|
| 48 |
+
]
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
resource "kubernetes_namespace" "vault" {
|
| 52 |
+
metadata {
|
| 53 |
+
name = "vault"
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
resource "kubernetes_persistent_volume_claim" "audit_log" {
|
| 58 |
+
metadata {
|
| 59 |
+
name = "audit-log-pvc"
|
| 60 |
+
namespace = "vault"
|
| 61 |
+
}
|
| 62 |
+
spec {
|
| 63 |
+
access_modes = ["ReadWriteOnce"]
|
| 64 |
+
resources {
|
| 65 |
+
requests {
|
| 66 |
+
storage = "10Gi"
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
storage_class_name = "audit-storage-class"
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
resource "vault_mount" "pki" {
|
| 74 |
+
path = "pki"
|
| 75 |
+
type = "pki"
|
| 76 |
+
description = "PKI secrets engine"
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
resource "vault_pki_secret_backend_root_cert" "root_ca" {
|
| 80 |
+
backend = vault_mount.pki.path
|
| 81 |
+
common_name = "example.com"
|
| 82 |
+
ttl = "87600h"
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
resource "vault_pki_secret_backend_intermediate_cert_request" "intermediate_ca" {
|
| 86 |
+
backend = vault_mount.pki.path
|
| 87 |
+
common_name = "intermediate.example.com"
|
| 88 |
+
ttl = "43800h"
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
resource "vault_auth_backend" "kubernetes" {
|
| 92 |
+
type = "kubernetes"
|
| 93 |
+
description = "Kubernetes auth backend"
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
resource "vault_kubernetes_auth_backend_config" "config" {
|
| 97 |
+
backend = vault_auth_backend.kubernetes.path
|
| 98 |
+
kubernetes_host = "https://kubernetes.default.svc"
|
| 99 |
+
kubernetes_ca_cert = file("/var/run/secrets/kubernetes.io/serviceaccount/ca.crt")
|
| 100 |
+
token_reviewer_jwt = file("/var/run/secrets/kubernetes.io/serviceaccount/token")
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
resource "vault_kubernetes_auth_backend_role" "example" {
|
| 104 |
+
backend = vault_auth_backend.kubernetes.path
|
| 105 |
+
role_name = "example-role"
|
| 106 |
+
bound_service_account_names = ["example-sa"]
|
| 107 |
+
bound_service_account_namespaces = ["default"]
|
| 108 |
+
policies = ["example-policy"]
|
| 109 |
+
ttl = "1h"
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
resource "vault_aws_secret_backend" "aws" {
|
| 113 |
+
path = "aws"
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
resource "vault_aws_secret_backend_role" "iam_role" {
|
| 117 |
+
backend = vault_aws_secret_backend.aws.path
|
| 118 |
+
role = "arn:aws:iam::123456789012:role/example-role"
|
| 119 |
+
credential_type = "iam_user"
|
| 120 |
+
policy_document = <<EOF
|
| 121 |
+
{
|
| 122 |
+
"Version": "2012-10-17",
|
| 123 |
+
"Statement": [
|
| 124 |
+
{
|
| 125 |
+
"Effect": "Allow",
|
| 126 |
+
"Action": "ec2:*",
|
| 127 |
+
"Resource": "*"
|
| 128 |
+
}
|
| 129 |
+
]
|
| 130 |
+
}
|
| 131 |
+
EOF
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
resource "vault_database_secret_backend_connection" "postgres" {
|
| 135 |
+
backend = "database"
|
| 136 |
+
name = "postgres"
|
| 137 |
+
allowed_roles = ["readonly"]
|
| 138 |
+
connection_url = "postgresql://{{username}}:{{password}}@db.example.com:5432/postgres?sslmode=disable"
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
resource "vault_database_secret_backend_role" "readonly" {
|
| 142 |
+
backend = "database"
|
| 143 |
+
name = "readonly"
|
| 144 |
+
db_name = vault_database_secret_backend_connection.postgres.name
|
| 145 |
+
creation_statements = ["CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}';"]
|
| 146 |
+
revocation_statements = ["ALTER ROLE \"{{name}}\" NOLOGIN;"]
|
| 147 |
+
default_ttl = "1h"
|
| 148 |
+
max_ttl = "24h"
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
resource "vault_transit_secret_backend" "transit" {
|
| 152 |
+
path = "transit"
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
resource "vault_policy" "example-policy" {
|
| 156 |
+
name = "example-policy"
|
| 157 |
+
policy = <<EOF
|
| 158 |
+
path "secret/data/*" {
|
| 159 |
+
capabilities = ["create", "read", "update", "delete", "list"]
|
| 160 |
+
}
|
| 161 |
+
EOF
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
resource "vault_identity_entity" "example_entity" {
|
| 165 |
+
name = "example-entity"
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
resource "vault_identity_entity_alias" "example_alias" {
|
| 169 |
+
name = "example-alias"
|
| 170 |
+
canonical_id = vault_identity_entity.example_entity.id
|
| 171 |
+
mount_accessor = vault_auth_backend.kubernetes.accessor
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
resource "vault_mfa_duo" "example_mfa" {
|
| 175 |
+
name = "example-mfa"
|
| 176 |
+
type = "duo"
|
| 177 |
+
mount_accessor = vault_auth_backend.kubernetes.accessor
|
| 178 |
+
config = {
|
| 179 |
+
host = "api-XXXXXXXX.duosecurity.com"
|
| 180 |
+
integration_key = "DIXXXXXXXXXXXXXXXXXX"
|
| 181 |
+
secret_key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
| 182 |
+
}
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
resource "kubernetes_custom_resource_definition" "vault_secrets_operator" {
|
| 186 |
+
metadata {
|
| 187 |
+
name = "vaultsecretsoperator"
|
| 188 |
+
}
|
| 189 |
+
spec {
|
| 190 |
+
group = "vault.hashicorp.com"
|
| 191 |
+
names {
|
| 192 |
+
kind = "VaultSecret"
|
| 193 |
+
listKind = "VaultSecretList"
|
| 194 |
+
plural = "vaultsecrets"
|
| 195 |
+
singular = "vaultsecret"
|
| 196 |
+
}
|
| 197 |
+
scope = "Namespaced"
|
| 198 |
+
versions {
|
| 199 |
+
name = "v1"
|
| 200 |
+
served = true
|
| 201 |
+
storage = true
|
| 202 |
+
}
|
| 203 |
+
}
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
resource "kubernetes_custom_resource_definition" "vault_static_secret" {
|
| 207 |
+
metadata {
|
| 208 |
+
name = "vaultstaticsecret"
|
| 209 |
+
}
|
| 210 |
+
spec {
|
| 211 |
+
group = "vault.hashicorp.com"
|
| 212 |
+
names {
|
| 213 |
+
kind = "VaultStaticSecret"
|
| 214 |
+
listKind = "VaultStaticSecretList"
|
| 215 |
+
plural = "vaultstaticsecrets"
|
| 216 |
+
singular = "vaultstaticsecret"
|
| 217 |
+
}
|
| 218 |
+
scope = "Namespaced"
|
| 219 |
+
versions {
|
| 220 |
+
name = "v1"
|
| 221 |
+
served = true
|
| 222 |
+
storage = true
|
| 223 |
+
}
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
resource "kubernetes_custom_resource_definition" "vault_dynamic_secret" {
|
| 228 |
+
metadata {
|
| 229 |
+
name = "vaultdynamicsecret"
|
| 230 |
+
}
|
| 231 |
+
spec {
|
| 232 |
+
group = "vault.hashicorp.com"
|
| 233 |
+
names {
|
| 234 |
+
kind = "VaultDynamicSecret"
|
| 235 |
+
listKind = "VaultDynamicSecretList"
|
| 236 |
+
plural = "vaultdynamicsecrets"
|
| 237 |
+
singular = "vaultdynamicsecret"
|
| 238 |
+
}
|
| 239 |
+
scope = "Namespaced"
|
| 240 |
+
versions {
|
| 241 |
+
name = "v1"
|
| 242 |
+
served = true
|
| 243 |
+
storage = true
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
resource "cert_manager_cluster_issuer" "vault_issuer" {
|
| 249 |
+
metadata {
|
| 250 |
+
name = "vault-issuer"
|
| 251 |
+
}
|
| 252 |
+
spec {
|
| 253 |
+
vault {
|
| 254 |
+
server = "http://vault.vault.svc.cluster.local:8200"
|
| 255 |
+
path = "pki/sign/example-dot-com"
|
| 256 |
+
auth {
|
| 257 |
+
tokenSecretRef {
|
| 258 |
+
name = "vault-token"
|
| 259 |
+
key = "token"
|
| 260 |
+
}
|
| 261 |
+
}
|
| 262 |
+
}
|
| 263 |
+
}
|
| 264 |
+
}
|
generated/complex/gpt-4o/complex-k8s-tf-007/main.yaml
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
+
spec:
|
| 15 |
+
containers:
|
| 16 |
+
- name: falco
|
| 17 |
+
image: falcosecurity/falco:latest
|
| 18 |
+
securityContext:
|
| 19 |
+
privileged: true
|
| 20 |
+
volumeMounts:
|
| 21 |
+
- mountPath: /host/var/run/docker.sock
|
| 22 |
+
name: docker-socket
|
| 23 |
+
- mountPath: /host/proc
|
| 24 |
+
name: proc
|
| 25 |
+
readOnly: true
|
| 26 |
+
- mountPath: /host/boot
|
| 27 |
+
name: boot
|
| 28 |
+
readOnly: true
|
| 29 |
+
- mountPath: /host/lib/modules
|
| 30 |
+
name: lib-modules
|
| 31 |
+
readOnly: true
|
| 32 |
+
- mountPath: /host/usr
|
| 33 |
+
name: usr
|
| 34 |
+
readOnly: true
|
| 35 |
+
env:
|
| 36 |
+
- name: FALCO_RULES_FILE
|
| 37 |
+
value: /etc/falco/falco_rules.yaml
|
| 38 |
+
- name: FALCO_SIDECAR_CONFIG
|
| 39 |
+
value: /etc/falco/falcosidekick.yaml
|
| 40 |
+
volumes:
|
| 41 |
+
- name: docker-socket
|
| 42 |
+
hostPath:
|
| 43 |
+
path: /var/run/docker.sock
|
| 44 |
+
- name: proc
|
| 45 |
+
hostPath:
|
| 46 |
+
path: /proc
|
| 47 |
+
- name: boot
|
| 48 |
+
hostPath:
|
| 49 |
+
path: /boot
|
| 50 |
+
- name: lib-modules
|
| 51 |
+
hostPath:
|
| 52 |
+
path: /lib/modules
|
| 53 |
+
- name: usr
|
| 54 |
+
hostPath:
|
| 55 |
+
path: /usr
|
| 56 |
+
---
|
| 57 |
+
apiVersion: v1
|
| 58 |
+
kind: ConfigMap
|
| 59 |
+
metadata:
|
| 60 |
+
name: falco-rules
|
| 61 |
+
namespace: kube-system
|
| 62 |
+
data:
|
| 63 |
+
falco_rules.yaml: |
|
| 64 |
+
- rule: Detect Crypto Mining
|
| 65 |
+
desc: Detect crypto mining activity
|
| 66 |
+
condition: spawned_process and proc.name in (crypto-miners)
|
| 67 |
+
output: "Crypto mining detected (user=%user.name command=%proc.cmdline)"
|
| 68 |
+
priority: WARNING
|
| 69 |
+
- rule: Detect Reverse Shell
|
| 70 |
+
desc: Detect reverse shell attempts
|
| 71 |
+
condition: spawned_process and proc.name in (reverse-shells)
|
| 72 |
+
output: "Reverse shell detected (user=%user.name command=%proc.cmdline)"
|
| 73 |
+
priority: WARNING
|
| 74 |
+
- rule: Sensitive File Access
|
| 75 |
+
desc: Detect access to sensitive files
|
| 76 |
+
condition: open_read and fd.name in (sensitive-files)
|
| 77 |
+
output: "Sensitive file access detected (user=%user.name file=%fd.name)"
|
| 78 |
+
priority: WARNING
|
| 79 |
+
- rule: Privilege Escalation
|
| 80 |
+
desc: Detect privilege escalation attempts
|
| 81 |
+
condition: spawned_process and proc.name in (priv-escalation-tools)
|
| 82 |
+
output: "Privilege escalation detected (user=%user.name command=%proc.cmdline)"
|
| 83 |
+
priority: WARNING
|
| 84 |
+
---
|
| 85 |
+
apiVersion: v1
|
| 86 |
+
kind: ConfigMap
|
| 87 |
+
metadata:
|
| 88 |
+
name: falcosidekick-config
|
| 89 |
+
namespace: kube-system
|
| 90 |
+
data:
|
| 91 |
+
falcosidekick.yaml: |
|
| 92 |
+
config:
|
| 93 |
+
slack:
|
| 94 |
+
webhookurl: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
|
| 95 |
+
pagerduty:
|
| 96 |
+
routingkey: "your-pagerduty-routing-key"
|
| 97 |
+
loki:
|
| 98 |
+
hostport: "http://loki:3100"
|
| 99 |
+
---
|
| 100 |
+
apiVersion: apps/v1
|
| 101 |
+
kind: DaemonSet
|
| 102 |
+
metadata:
|
| 103 |
+
name: tetragon
|
| 104 |
+
namespace: kube-system
|
| 105 |
+
spec:
|
| 106 |
+
selector:
|
| 107 |
+
matchLabels:
|
| 108 |
+
app: tetragon
|
| 109 |
+
template:
|
| 110 |
+
metadata:
|
| 111 |
+
labels:
|
| 112 |
+
app: tetragon
|
| 113 |
+
spec:
|
| 114 |
+
containers:
|
| 115 |
+
- name: tetragon
|
| 116 |
+
image: cilium/tetragon:latest
|
| 117 |
+
securityContext:
|
| 118 |
+
privileged: true
|
| 119 |
+
---
|
| 120 |
+
apiVersion: v1
|
| 121 |
+
kind: ConfigMap
|
| 122 |
+
metadata:
|
| 123 |
+
name: tetragon-policies
|
| 124 |
+
namespace: kube-system
|
| 125 |
+
data:
|
| 126 |
+
tracing-policies.yaml: |
|
| 127 |
+
apiVersion: cilium.io/v1alpha1
|
| 128 |
+
kind: TracingPolicy
|
| 129 |
+
metadata:
|
| 130 |
+
name: block-unexpected-processes
|
| 131 |
+
spec:
|
| 132 |
+
selectors:
|
| 133 |
+
matchPIDs:
|
| 134 |
+
- namespace: default
|
| 135 |
+
action: block
|
| 136 |
+
matchActions:
|
| 137 |
+
- exec
|
| 138 |
+
---
|
| 139 |
+
apiVersion: cilium.io/v1alpha1
|
| 140 |
+
kind: TracingPolicy
|
| 141 |
+
metadata:
|
| 142 |
+
name: block-unexpected-network
|
| 143 |
+
spec:
|
| 144 |
+
selectors:
|
| 145 |
+
matchPIDs:
|
| 146 |
+
- namespace: default
|
| 147 |
+
action: block
|
| 148 |
+
matchActions:
|
| 149 |
+
- connect
|
| 150 |
+
---
|
| 151 |
+
apiVersion: apps/v1
|
| 152 |
+
kind: Deployment
|
| 153 |
+
metadata:
|
| 154 |
+
name: trivy-operator
|
| 155 |
+
namespace: kube-system
|
| 156 |
+
spec:
|
| 157 |
+
replicas: 1
|
| 158 |
+
selector:
|
| 159 |
+
matchLabels:
|
| 160 |
+
app: trivy-operator
|
| 161 |
+
template:
|
| 162 |
+
metadata:
|
| 163 |
+
labels:
|
| 164 |
+
app: trivy-operator
|
| 165 |
+
spec:
|
| 166 |
+
containers:
|
| 167 |
+
- name: trivy-operator
|
| 168 |
+
image: aquasec/trivy-operator:latest
|
| 169 |
+
env:
|
| 170 |
+
- name: TRIVY_OPERATOR_SLACK_WEBHOOK
|
| 171 |
+
value: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
|
| 172 |
+
---
|
| 173 |
+
apiVersion: apps/v1
|
| 174 |
+
kind: Deployment
|
| 175 |
+
metadata:
|
| 176 |
+
name: kubescape
|
| 177 |
+
namespace: kube-system
|
| 178 |
+
spec:
|
| 179 |
+
replicas: 1
|
| 180 |
+
selector:
|
| 181 |
+
matchLabels:
|
| 182 |
+
app: kubescape
|
| 183 |
+
template:
|
| 184 |
+
metadata:
|
| 185 |
+
labels:
|
| 186 |
+
app: kubescape
|
| 187 |
+
spec:
|
| 188 |
+
containers:
|
| 189 |
+
- name: kubescape
|
| 190 |
+
image: armosec/kubescape:latest
|
| 191 |
+
args:
|
| 192 |
+
- scan
|
| 193 |
+
- --compliance
|
| 194 |
+
- --schedule
|
| 195 |
+
- "0 0 * * *"
|
| 196 |
+
- --output
|
| 197 |
+
- prometheus
|
| 198 |
+
---
|
| 199 |
+
apiVersion: policy/v1
|
| 200 |
+
kind: PodSecurityPolicy
|
| 201 |
+
metadata:
|
| 202 |
+
name: restricted-psp
|
| 203 |
+
spec:
|
| 204 |
+
privileged: false
|
| 205 |
+
allowPrivilegeEscalation: false
|
| 206 |
+
requiredDropCapabilities:
|
| 207 |
+
- ALL
|
| 208 |
+
volumes:
|
| 209 |
+
- 'configMap'
|
| 210 |
+
- 'emptyDir'
|
| 211 |
+
- 'projected'
|
| 212 |
+
- 'secret'
|
| 213 |
+
- 'downwardAPI'
|
| 214 |
+
- 'persistentVolumeClaim'
|
| 215 |
+
hostNetwork: false
|
| 216 |
+
hostIPC: false
|
| 217 |
+
hostPID: false
|
| 218 |
+
runAsUser:
|
| 219 |
+
rule: 'MustRunAsNonRoot'
|
| 220 |
+
seLinux:
|
| 221 |
+
rule: 'RunAsAny'
|
| 222 |
+
supplementalGroups:
|
| 223 |
+
rule: 'MustRunAs'
|
| 224 |
+
ranges:
|
| 225 |
+
- min: 1
|
| 226 |
+
max: 65535
|
| 227 |
+
fsGroup:
|
| 228 |
+
rule: 'MustRunAs'
|
| 229 |
+
ranges:
|
| 230 |
+
- min: 1
|
| 231 |
+
max: 65535
|
| 232 |
+
---
|
| 233 |
+
apiVersion: admissionregistration.k8s.io/v1
|
| 234 |
+
kind: ValidatingAdmissionPolicy
|
| 235 |
+
metadata:
|
| 236 |
+
name: restrict-host-access
|
| 237 |
+
spec:
|
| 238 |
+
matchConstraints:
|
| 239 |
+
resourceRules:
|
| 240 |
+
- apiGroups: [""]
|
| 241 |
+
apiVersions: ["v1"]
|
| 242 |
+
resources: ["pods"]
|
| 243 |
+
validations:
|
| 244 |
+
- expression: "!object.spec.hostNetwork && !object.spec.hostPID && !object.spec.hostIPC"
|
| 245 |
+
---
|
| 246 |
+
apiVersion: admissionregistration.k8s.io/v1
|
| 247 |
+
kind: MutatingWebhookConfiguration
|
| 248 |
+
metadata:
|
| 249 |
+
name: seccomp-apparmor-webhook
|
| 250 |
+
webhooks:
|
| 251 |
+
- name: seccomp-apparmor.k8s.io
|
| 252 |
+
clientConfig:
|
| 253 |
+
service:
|
| 254 |
+
name: seccomp-apparmor-webhook
|
| 255 |
+
namespace: kube-system
|
| 256 |
+
path: "/mutate"
|
| 257 |
+
rules:
|
| 258 |
+
- operations: ["CREATE"]
|
| 259 |
+
apiGroups: [""]
|
| 260 |
+
apiVersions: ["v1"]
|
| 261 |
+
resources: ["pods"]
|
| 262 |
+
admissionReviewVersions: ["v1"]
|
| 263 |
+
sideEffects: None
|
| 264 |
+
timeoutSeconds: 5
|
generated/complex/gpt-4o/complex-k8s-tf-008/main.tf
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "kubernetes" {
|
| 2 |
+
config_path = "~/.kube/config"
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
provider "helm" {
|
| 6 |
+
kubernetes {
|
| 7 |
+
config_path = "~/.kube/config"
|
| 8 |
+
}
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
resource "helm_release" "argocd" {
|
| 12 |
+
name = "argocd"
|
| 13 |
+
repository = "https://argoproj.github.io/argo-helm"
|
| 14 |
+
chart = "argo-cd"
|
| 15 |
+
namespace = "argocd"
|
| 16 |
+
|
| 17 |
+
values = [
|
| 18 |
+
<<EOF
|
| 19 |
+
server:
|
| 20 |
+
oidcConfig:
|
| 21 |
+
name: Keycloak
|
| 22 |
+
issuer: https://keycloak.example.com/auth/realms/myrealm
|
| 23 |
+
clientID: argocd
|
| 24 |
+
clientSecret: myclientsecret
|
| 25 |
+
requestedScopes: ["openid", "profile", "email", "groups"]
|
| 26 |
+
|
| 27 |
+
rbac:
|
| 28 |
+
policy.csv: |
|
| 29 |
+
g, team1, role:admin
|
| 30 |
+
g, team2, role:readonly
|
| 31 |
+
policy.default: role:readonly
|
| 32 |
+
|
| 33 |
+
project:
|
| 34 |
+
- name: team1-project
|
| 35 |
+
sourceRepos:
|
| 36 |
+
- "https://github.com/org/repo1"
|
| 37 |
+
destinations:
|
| 38 |
+
- namespace: team1-ns
|
| 39 |
+
server: https://kubernetes.default.svc
|
| 40 |
+
clusterResourceWhitelist:
|
| 41 |
+
- group: '*'
|
| 42 |
+
kind: '*'
|
| 43 |
+
clusterResourceBlacklist:
|
| 44 |
+
- group: ''
|
| 45 |
+
kind: 'Secret'
|
| 46 |
+
syncWindows:
|
| 47 |
+
- kind: allow
|
| 48 |
+
schedule: "9-17 * * 1-5"
|
| 49 |
+
duration: 8h
|
| 50 |
+
applications:
|
| 51 |
+
- '*'
|
| 52 |
+
|
| 53 |
+
notifications:
|
| 54 |
+
triggers:
|
| 55 |
+
- name: on-sync-succeeded
|
| 56 |
+
condition: app.status.operationState.phase == "Succeeded"
|
| 57 |
+
template: app-sync-succeeded
|
| 58 |
+
templates:
|
| 59 |
+
- name: app-sync-succeeded
|
| 60 |
+
title: Application {{.app.metadata.name}} sync succeeded
|
| 61 |
+
body: Application {{.app.metadata.name}} at {{.app.spec.source.repoURL}} sync succeeded.
|
| 62 |
+
services:
|
| 63 |
+
- name: slack
|
| 64 |
+
url: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
|
| 65 |
+
- name: github
|
| 66 |
+
url: https://api.github.com/repos/org/repo/statuses/{{.app.status.sync.revision}}
|
| 67 |
+
|
| 68 |
+
imageUpdater:
|
| 69 |
+
enabled: true
|
| 70 |
+
writeBackMethod: git
|
| 71 |
+
semver:
|
| 72 |
+
constraints: ">=1.0.0 <2.0.0"
|
| 73 |
+
|
| 74 |
+
rollouts:
|
| 75 |
+
analysisTemplates:
|
| 76 |
+
- name: canary-analysis
|
| 77 |
+
spec:
|
| 78 |
+
metrics:
|
| 79 |
+
- name: request-success-rate
|
| 80 |
+
interval: 1m
|
| 81 |
+
successCondition: result > 0.95
|
| 82 |
+
failureCondition: result < 0.90
|
| 83 |
+
provider:
|
| 84 |
+
prometheus:
|
| 85 |
+
address: http://prometheus-server
|
| 86 |
+
query: sum(rate(http_requests_total{status=~"2.."}[1m])) / sum(rate(http_requests_total[1m]))
|
| 87 |
+
webhooks:
|
| 88 |
+
- name: integration-tests
|
| 89 |
+
url: http://integration-tests-svc/run
|
| 90 |
+
timeoutSeconds: 300
|
| 91 |
+
failureThreshold: 1
|
| 92 |
+
successThreshold: 1
|
| 93 |
+
|
| 94 |
+
events:
|
| 95 |
+
eventSources:
|
| 96 |
+
- name: webhook-source
|
| 97 |
+
webhook:
|
| 98 |
+
endpoint: /webhook
|
| 99 |
+
port: 12000
|
| 100 |
+
- name: s3-source
|
| 101 |
+
s3:
|
| 102 |
+
bucket: my-bucket
|
| 103 |
+
events:
|
| 104 |
+
- s3:ObjectCreated:*
|
| 105 |
+
- name: kafka-source
|
| 106 |
+
kafka:
|
| 107 |
+
url: kafka:9092
|
| 108 |
+
topic: my-topic
|
| 109 |
+
sensors:
|
| 110 |
+
- name: my-sensor
|
| 111 |
+
dependencies:
|
| 112 |
+
- name: webhook-dep
|
| 113 |
+
eventSourceName: webhook-source
|
| 114 |
+
eventName: example
|
| 115 |
+
- name: s3-dep
|
| 116 |
+
eventSourceName: s3-source
|
| 117 |
+
eventName: example
|
| 118 |
+
- name: kafka-dep
|
| 119 |
+
eventSourceName: kafka-source
|
| 120 |
+
eventName: example
|
| 121 |
+
triggers:
|
| 122 |
+
- template:
|
| 123 |
+
name: workflow-trigger
|
| 124 |
+
argoWorkflow:
|
| 125 |
+
source:
|
| 126 |
+
resource:
|
| 127 |
+
apiVersion: argoproj.io/v1alpha1
|
| 128 |
+
kind: Workflow
|
| 129 |
+
metadata:
|
| 130 |
+
generateName: triggered-workflow-
|
| 131 |
+
spec:
|
| 132 |
+
entrypoint: main
|
| 133 |
+
templates:
|
| 134 |
+
- name: main
|
| 135 |
+
container:
|
| 136 |
+
image: my-image
|
| 137 |
+
EOF
|
| 138 |
+
]
|
| 139 |
+
}
|
generated/complex/gpt-4o/complex-k8s-tf-009/main.yaml
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: v1
|
| 2 |
+
kind: Namespace
|
| 3 |
+
metadata:
|
| 4 |
+
name: kong
|
| 5 |
+
---
|
| 6 |
+
apiVersion: v1
|
| 7 |
+
kind: Namespace
|
| 8 |
+
metadata:
|
| 9 |
+
name: keycloak
|
| 10 |
+
---
|
| 11 |
+
apiVersion: v1
|
| 12 |
+
kind: Namespace
|
| 13 |
+
metadata:
|
| 14 |
+
name: backstage
|
| 15 |
+
---
|
| 16 |
+
apiVersion: apps/v1
|
| 17 |
+
kind: Deployment
|
| 18 |
+
metadata:
|
| 19 |
+
name: kong
|
| 20 |
+
namespace: kong
|
| 21 |
+
spec:
|
| 22 |
+
replicas: 2
|
| 23 |
+
selector:
|
| 24 |
+
matchLabels:
|
| 25 |
+
app: kong
|
| 26 |
+
template:
|
| 27 |
+
metadata:
|
| 28 |
+
labels:
|
| 29 |
+
app: kong
|
| 30 |
+
spec:
|
| 31 |
+
containers:
|
| 32 |
+
- name: kong
|
| 33 |
+
image: kong/kong-gateway:latest
|
| 34 |
+
env:
|
| 35 |
+
- name: KONG_DATABASE
|
| 36 |
+
value: "off"
|
| 37 |
+
- name: KONG_PROXY_LISTEN
|
| 38 |
+
value: "0.0.0.0:8000, 0.0.0.0:8443 ssl"
|
| 39 |
+
- name: KONG_ADMIN_LISTEN
|
| 40 |
+
value: "0.0.0.0:8001, 0.0.0.0:8444 ssl"
|
| 41 |
+
ports:
|
| 42 |
+
- containerPort: 8000
|
| 43 |
+
- containerPort: 8443
|
| 44 |
+
- containerPort: 8001
|
| 45 |
+
- containerPort: 8444
|
| 46 |
+
---
|
| 47 |
+
apiVersion: apps/v1
|
| 48 |
+
kind: Deployment
|
| 49 |
+
metadata:
|
| 50 |
+
name: keycloak
|
| 51 |
+
namespace: keycloak
|
| 52 |
+
spec:
|
| 53 |
+
replicas: 1
|
| 54 |
+
selector:
|
| 55 |
+
matchLabels:
|
| 56 |
+
app: keycloak
|
| 57 |
+
template:
|
| 58 |
+
metadata:
|
| 59 |
+
labels:
|
| 60 |
+
app: keycloak
|
| 61 |
+
spec:
|
| 62 |
+
containers:
|
| 63 |
+
- name: keycloak
|
| 64 |
+
image: quay.io/keycloak/keycloak:latest
|
| 65 |
+
env:
|
| 66 |
+
- name: DB_VENDOR
|
| 67 |
+
value: POSTGRES
|
| 68 |
+
- name: DB_ADDR
|
| 69 |
+
value: keycloak-db.keycloak.svc.cluster.local
|
| 70 |
+
- name: DB_DATABASE
|
| 71 |
+
value: keycloak
|
| 72 |
+
- name: DB_USER
|
| 73 |
+
value: keycloak
|
| 74 |
+
- name: DB_PASSWORD
|
| 75 |
+
valueFrom:
|
| 76 |
+
secretKeyRef:
|
| 77 |
+
name: keycloak-db-secret
|
| 78 |
+
key: password
|
| 79 |
+
ports:
|
| 80 |
+
- containerPort: 8080
|
| 81 |
+
---
|
| 82 |
+
apiVersion: apps/v1
|
| 83 |
+
kind: Deployment
|
| 84 |
+
metadata:
|
| 85 |
+
name: backstage
|
| 86 |
+
namespace: backstage
|
| 87 |
+
spec:
|
| 88 |
+
replicas: 1
|
| 89 |
+
selector:
|
| 90 |
+
matchLabels:
|
| 91 |
+
app: backstage
|
| 92 |
+
template:
|
| 93 |
+
metadata:
|
| 94 |
+
labels:
|
| 95 |
+
app: backstage
|
| 96 |
+
spec:
|
| 97 |
+
containers:
|
| 98 |
+
- name: backstage
|
| 99 |
+
image: backstage/backstage:latest
|
| 100 |
+
ports:
|
| 101 |
+
- containerPort: 7000
|
| 102 |
+
---
|
| 103 |
+
apiVersion: networking.k8s.io/v1
|
| 104 |
+
kind: NetworkPolicy
|
| 105 |
+
metadata:
|
| 106 |
+
name: kong-access
|
| 107 |
+
namespace: kong
|
| 108 |
+
spec:
|
| 109 |
+
podSelector:
|
| 110 |
+
matchLabels:
|
| 111 |
+
app: kong
|
| 112 |
+
policyTypes:
|
| 113 |
+
- Ingress
|
| 114 |
+
- Egress
|
| 115 |
+
ingress:
|
| 116 |
+
- from:
|
| 117 |
+
- namespaceSelector:
|
| 118 |
+
matchLabels:
|
| 119 |
+
name: backstage
|
| 120 |
+
ports:
|
| 121 |
+
- protocol: TCP
|
| 122 |
+
port: 7000
|
| 123 |
+
egress:
|
| 124 |
+
- to:
|
| 125 |
+
- namespaceSelector:
|
| 126 |
+
matchLabels:
|
| 127 |
+
name: keycloak
|
| 128 |
+
ports:
|
| 129 |
+
- protocol: TCP
|
| 130 |
+
port: 8080
|
| 131 |
+
---
|
| 132 |
+
apiVersion: policy/v1
|
| 133 |
+
kind: PodSecurityPolicy
|
| 134 |
+
metadata:
|
| 135 |
+
name: restricted
|
| 136 |
+
spec:
|
| 137 |
+
privileged: false
|
| 138 |
+
allowPrivilegeEscalation: false
|
| 139 |
+
requiredDropCapabilities:
|
| 140 |
+
- ALL
|
| 141 |
+
volumes:
|
| 142 |
+
- 'configMap'
|
| 143 |
+
- 'secret'
|
| 144 |
+
- 'emptyDir'
|
| 145 |
+
hostNetwork: false
|
| 146 |
+
hostIPC: false
|
| 147 |
+
hostPID: false
|
| 148 |
+
runAsUser:
|
| 149 |
+
rule: 'MustRunAsNonRoot'
|
| 150 |
+
seLinux:
|
| 151 |
+
rule: 'RunAsAny'
|
| 152 |
+
supplementalGroups:
|
| 153 |
+
rule: 'MustRunAs'
|
| 154 |
+
ranges:
|
| 155 |
+
- min: 1
|
| 156 |
+
max: 65535
|
| 157 |
+
fsGroup:
|
| 158 |
+
rule: 'MustRunAs'
|
| 159 |
+
ranges:
|
| 160 |
+
- min: 1
|
| 161 |
+
max: 65535
|
| 162 |
+
---
|
| 163 |
+
apiVersion: v1
|
| 164 |
+
kind: Service
|
| 165 |
+
metadata:
|
| 166 |
+
name: kong-proxy
|
| 167 |
+
namespace: kong
|
| 168 |
+
spec:
|
| 169 |
+
type: LoadBalancer
|
| 170 |
+
ports:
|
| 171 |
+
- port: 80
|
| 172 |
+
targetPort: 8000
|
| 173 |
+
- port: 443
|
| 174 |
+
targetPort: 8443
|
| 175 |
+
selector:
|
| 176 |
+
app: kong
|
| 177 |
+
---
|
| 178 |
+
apiVersion: v1
|
| 179 |
+
kind: Service
|
| 180 |
+
metadata:
|
| 181 |
+
name: keycloak
|
| 182 |
+
namespace: keycloak
|
| 183 |
+
spec:
|
| 184 |
+
ports:
|
| 185 |
+
- port: 8080
|
| 186 |
+
targetPort: 8080
|
| 187 |
+
selector:
|
| 188 |
+
app: keycloak
|
| 189 |
+
---
|
| 190 |
+
apiVersion: v1
|
| 191 |
+
kind: Service
|
| 192 |
+
metadata:
|
| 193 |
+
name: backstage
|
| 194 |
+
namespace: backstage
|
| 195 |
+
spec:
|
| 196 |
+
ports:
|
| 197 |
+
- port: 7000
|
| 198 |
+
targetPort: 7000
|
| 199 |
+
selector:
|
| 200 |
+
app: backstage
|
| 201 |
+
---
|
| 202 |
+
apiVersion: configuration.konghq.com/v1
|
| 203 |
+
kind: KongPlugin
|
| 204 |
+
metadata:
|
| 205 |
+
name: rate-limiting
|
| 206 |
+
namespace: kong
|
| 207 |
+
config:
|
| 208 |
+
minute: 20
|
| 209 |
+
policy: redis
|
| 210 |
+
plugin: rate-limiting
|
| 211 |
+
---
|
| 212 |
+
apiVersion: configuration.konghq.com/v1
|
| 213 |
+
kind: KongPlugin
|
| 214 |
+
metadata:
|
| 215 |
+
name: oidc
|
| 216 |
+
namespace: kong
|
| 217 |
+
config:
|
| 218 |
+
client_id: my-client-id
|
| 219 |
+
client_secret: my-client-secret
|
| 220 |
+
introspection_endpoint: http://keycloak.keycloak.svc.cluster.local:8080/auth/realms/myrealm/protocol/openid-connect/token/introspect
|
| 221 |
+
plugin: openid-connect
|
| 222 |
+
---
|
| 223 |
+
apiVersion: configuration.konghq.com/v1
|
| 224 |
+
kind: KongPlugin
|
| 225 |
+
metadata:
|
| 226 |
+
name: request-transformer
|
| 227 |
+
namespace: kong
|
| 228 |
+
config:
|
| 229 |
+
add:
|
| 230 |
+
headers:
|
| 231 |
+
- "X-Correlation-ID: $request_id"
|
| 232 |
+
plugin: request-transformer
|
| 233 |
+
---
|
| 234 |
+
apiVersion: configuration.konghq.com/v1
|
| 235 |
+
kind: KongPlugin
|
| 236 |
+
metadata:
|
| 237 |
+
name: response-transformer
|
| 238 |
+
namespace: kong
|
| 239 |
+
config:
|
| 240 |
+
remove:
|
| 241 |
+
headers:
|
| 242 |
+
- "Server"
|
| 243 |
+
plugin: response-transformer
|
| 244 |
+
---
|
| 245 |
+
apiVersion: configuration.konghq.com/v1
|
| 246 |
+
kind: KongPlugin
|
| 247 |
+
metadata:
|
| 248 |
+
name: ip-restriction
|
| 249 |
+
namespace: kong
|
| 250 |
+
config:
|
| 251 |
+
whitelist:
|
| 252 |
+
- "192.168.1.0/24"
|
| 253 |
+
plugin: ip-restriction
|
| 254 |
+
---
|
| 255 |
+
apiVersion: configuration.konghq.com/v1
|
| 256 |
+
kind: KongPlugin
|
| 257 |
+
metadata:
|
| 258 |
+
name: bot-detection
|
| 259 |
+
namespace: kong
|
| 260 |
+
plugin: bot-detection
|
| 261 |
+
---
|
| 262 |
+
apiVersion: apps/v1
|
| 263 |
+
kind: Deployment
|
| 264 |
+
metadata:
|
| 265 |
+
name: keycloak-db
|
| 266 |
+
namespace: keycloak
|
| 267 |
+
spec:
|
| 268 |
+
replicas: 1
|
| 269 |
+
selector:
|
| 270 |
+
matchLabels:
|
| 271 |
+
app: keycloak-db
|
| 272 |
+
template:
|
| 273 |
+
metadata:
|
| 274 |
+
labels:
|
| 275 |
+
app: keycloak-db
|
| 276 |
+
spec:
|
| 277 |
+
containers:
|
| 278 |
+
- name: postgres
|
| 279 |
+
image: postgres:latest
|
| 280 |
+
env:
|
| 281 |
+
- name: POSTGRES_DB
|
| 282 |
+
value: keycloak
|
| 283 |
+
- name: POSTGRES_USER
|
| 284 |
+
value: keycloak
|
| 285 |
+
- name: POSTGRES_PASSWORD
|
| 286 |
+
valueFrom:
|
| 287 |
+
secretKeyRef:
|
| 288 |
+
name: keycloak-db-secret
|
| 289 |
+
key: password
|
| 290 |
+
ports:
|
| 291 |
+
- containerPort: 5432
|
| 292 |
+
---
|
| 293 |
+
apiVersion: v1
|
| 294 |
+
kind: Secret
|
| 295 |
+
metadata:
|
| 296 |
+
name: keycloak-db-secret
|
| 297 |
+
namespace: keycloak
|
| 298 |
+
type: Opaque
|
| 299 |
+
data:
|
| 300 |
+
password: cGFzc3dvcmQ= # base64 encoded password
|
| 301 |
+
---
|
| 302 |
+
apiVersion: networking.istio.io/v1beta1
|
| 303 |
+
kind: PeerAuthentication
|
| 304 |
+
metadata:
|
| 305 |
+
name: default
|
| 306 |
+
namespace: kong
|
| 307 |
+
spec:
|
| 308 |
+
mtls:
|
| 309 |
+
mode: STRICT
|
| 310 |
+
---
|
| 311 |
+
apiVersion: networking.istio.io/v1beta1
|
| 312 |
+
kind: PeerAuthentication
|
| 313 |
+
metadata:
|
| 314 |
+
name: default
|
| 315 |
+
namespace: keycloak
|
| 316 |
+
spec:
|
| 317 |
+
mtls:
|
| 318 |
+
mode: STRICT
|
| 319 |
+
---
|
| 320 |
+
apiVersion: networking.istio.io/v1beta1
|
| 321 |
+
kind: PeerAuthentication
|
| 322 |
+
metadata:
|
| 323 |
+
name: default
|
| 324 |
+
namespace: backstage
|
| 325 |
+
spec:
|
| 326 |
+
mtls:
|
| 327 |
+
mode: STRICT
|
generated/complex/gpt-4o/complex-k8s-tf-010/main.tf
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider "kubernetes" {
|
| 2 |
+
config_path = "~/.kube/config"
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
provider "helm" {
|
| 6 |
+
kubernetes {
|
| 7 |
+
config_path = "~/.kube/config"
|
| 8 |
+
}
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
resource "helm_release" "velero" {
|
| 12 |
+
name = "velero"
|
| 13 |
+
repository = "https://vmware-tanzu.github.io/helm-charts"
|
| 14 |
+
chart = "velero"
|
| 15 |
+
version = "2.23.0"
|
| 16 |
+
|
| 17 |
+
set {
|
| 18 |
+
name = "configuration.backupStorageLocation.name"
|
| 19 |
+
value = "aws"
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
set {
|
| 23 |
+
name = "configuration.backupStorageLocation.bucket"
|
| 24 |
+
value = "velero-backups"
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
set {
|
| 28 |
+
name = "configuration.backupStorageLocation.config.region"
|
| 29 |
+
value = "us-west-2"
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
set {
|
| 33 |
+
name = "configuration.backupStorageLocation.config.s3ForcePathStyle"
|
| 34 |
+
value = "true"
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
set {
|
| 38 |
+
name = "configuration.backupStorageLocation.config.serverSideEncryption"
|
| 39 |
+
value = "AES256"
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
set {
|
| 43 |
+
name = "configuration.backupStorageLocation.config.immutable"
|
| 44 |
+
value = "true"
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
set {
|
| 48 |
+
name = "configuration.backupStorageLocation.config.retentionPolicy"
|
| 49 |
+
value = "30d"
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
set {
|
| 53 |
+
name = "configuration.schedule"
|
| 54 |
+
value = "0 2 * * *"
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
set {
|
| 58 |
+
name = "configuration.scheduleSelector"
|
| 59 |
+
value = "environment=production"
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
set {
|
| 63 |
+
name = "configuration.includeNamespaces"
|
| 64 |
+
value = "default,production"
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
set {
|
| 68 |
+
name = "configuration.excludeNamespaces"
|
| 69 |
+
value = "kube-system"
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
set {
|
| 73 |
+
name = "configuration.preBackupHooks"
|
| 74 |
+
value = "snapshot.sh"
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
set {
|
| 78 |
+
name = "configuration.postBackupHooks"
|
| 79 |
+
value = "cleanup.sh"
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
resource "helm_release" "submariner" {
|
| 84 |
+
name = "submariner"
|
| 85 |
+
repository = "https://submariner.io/charts"
|
| 86 |
+
chart = "submariner"
|
| 87 |
+
version = "0.11.0"
|
| 88 |
+
|
| 89 |
+
set {
|
| 90 |
+
name = "globalnet.enabled"
|
| 91 |
+
value = "true"
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
set {
|
| 95 |
+
name = "broker.k8sSecret"
|
| 96 |
+
value = "submariner-broker"
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
set {
|
| 100 |
+
name = "globalnet.cidrRange"
|
| 101 |
+
value = "169.254.0.0/16"
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
set {
|
| 105 |
+
name = "serviceDiscovery.enabled"
|
| 106 |
+
value = "true"
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
resource "helm_release" "cloudcasa" {
|
| 111 |
+
name = "cloudcasa"
|
| 112 |
+
repository = "https://cloudcasa.io/charts"
|
| 113 |
+
chart = "cloudcasa"
|
| 114 |
+
version = "1.0.0"
|
| 115 |
+
|
| 116 |
+
set {
|
| 117 |
+
name = "configuration.applicationBackup"
|
| 118 |
+
value = "true"
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
set {
|
| 122 |
+
name = "configuration.helmReleaseMetadata"
|
| 123 |
+
value = "true"
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
set {
|
| 127 |
+
name = "configuration.pvcSnapshots"
|
| 128 |
+
value = "true"
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
set {
|
| 132 |
+
name = "configuration.csiSnapshotClass"
|
| 133 |
+
value = "csi-snapshot-class"
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
resource "kubernetes_custom_resource_definition" "failover_operator" {
|
| 138 |
+
metadata {
|
| 139 |
+
name = "failover-operator"
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
spec {
|
| 143 |
+
group = "failover.example.com"
|
| 144 |
+
version = "v1"
|
| 145 |
+
names {
|
| 146 |
+
kind = "Failover"
|
| 147 |
+
listKind = "FailoverList"
|
| 148 |
+
plural = "failovers"
|
| 149 |
+
singular = "failover"
|
| 150 |
+
}
|
| 151 |
+
scope = "Namespaced"
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
resource "kubernetes_cluster_role" "dr_operator" {
|
| 156 |
+
metadata {
|
| 157 |
+
name = "dr-operator"
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
rule {
|
| 161 |
+
api_groups = [""]
|
| 162 |
+
resources = ["pods", "services", "endpoints", "persistentvolumeclaims"]
|
| 163 |
+
verbs = ["get", "list", "watch", "create", "update", "patch", "delete"]
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
rule {
|
| 167 |
+
api_groups = ["apps"]
|
| 168 |
+
resources = ["deployments", "statefulsets"]
|
| 169 |
+
verbs = ["get", "list", "watch", "create", "update", "patch", "delete"]
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
rule {
|
| 173 |
+
api_groups = ["failover.example.com"]
|
| 174 |
+
resources = ["failovers"]
|
| 175 |
+
verbs = ["get", "list", "watch", "create", "update", "patch", "delete"]
|
| 176 |
+
}
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
resource "kubernetes_cron_job" "dr_drill" {
|
| 180 |
+
metadata {
|
| 181 |
+
name = "dr-drill"
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
spec {
|
| 185 |
+
schedule = "0 3 * * *"
|
| 186 |
+
job_template {
|
| 187 |
+
spec {
|
| 188 |
+
template {
|
| 189 |
+
spec {
|
| 190 |
+
container {
|
| 191 |
+
name = "dr-drill"
|
| 192 |
+
image = "dr-drill-image:latest"
|
| 193 |
+
command = ["/bin/sh", "-c", "validate-backup.sh"]
|
| 194 |
+
}
|
| 195 |
+
restart_policy = "OnFailure"
|
| 196 |
+
}
|
| 197 |
+
}
|
| 198 |
+
}
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
resource "prometheus_alert_rule" "backup_freshness" {
|
| 204 |
+
alert = "BackupFreshness"
|
| 205 |
+
expr = "time() - velero_backup_last_successful_timestamp_seconds > 86400"
|
| 206 |
+
labels = {
|
| 207 |
+
severity = "warning"
|
| 208 |
+
}
|
| 209 |
+
annotations = {
|
| 210 |
+
summary = "Backup freshness alert"
|
| 211 |
+
description = "The last successful Velero backup is older than 24 hours."
|
| 212 |
+
}
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
resource "prometheus_alert_rule" "cross_cluster_connectivity" {
|
| 216 |
+
alert = "CrossClusterConnectivity"
|
| 217 |
+
expr = "submariner_gateway_down > 0"
|
| 218 |
+
labels = {
|
| 219 |
+
severity = "critical"
|
| 220 |
+
}
|
| 221 |
+
annotations = {
|
| 222 |
+
summary = "Cross-cluster connectivity alert"
|
| 223 |
+
description = "One or more Submariner gateways are down."
|
| 224 |
+
}
|
| 225 |
+
}
|