|
1 | | -resource "awscc_bedrock_guardrail" "runtask_fulfillment" { |
2 | | - name = "${local.solution_prefix}-guardrail" |
| 1 | +resource "aws_bedrock_guardrail" "runtask_fulfillment" { |
| 2 | + name = "${local.solution_prefix}-guardrails" |
3 | 3 | blocked_input_messaging = "Unfortunately we are unable to provide response for this input" |
4 | 4 | blocked_outputs_messaging = "Unfortunately we are unable to provide response for this input" |
5 | 5 | description = "Basic Bedrock Guardrail for sensitive info exfiltration" |
6 | 6 |
|
7 | 7 | # detect and filter harmful user inputs and FM-generated outputs |
8 | | - content_policy_config = { |
9 | | - filters_config = [ |
10 | | - { |
11 | | - input_strength = "HIGH" |
12 | | - output_strength = "HIGH" |
13 | | - type = "SEXUAL" |
14 | | - }, |
15 | | - { |
16 | | - input_strength = "HIGH" |
17 | | - output_strength = "HIGH" |
18 | | - type = "VIOLENCE" |
19 | | - }, |
20 | | - { |
21 | | - input_strength = "HIGH" |
22 | | - output_strength = "HIGH" |
23 | | - type = "HATE" |
24 | | - }, |
25 | | - { |
26 | | - input_strength = "HIGH" |
27 | | - output_strength = "HIGH" |
28 | | - type = "INSULTS" |
29 | | - }, |
30 | | - { |
31 | | - input_strength = "HIGH" |
32 | | - output_strength = "HIGH" |
33 | | - type = "MISCONDUCT" |
34 | | - }, |
35 | | - { |
36 | | - input_strength = "NONE" |
37 | | - output_strength = "NONE" |
38 | | - type = "PROMPT_ATTACK" |
39 | | - } |
40 | | - ] |
| 8 | + content_policy_config { |
| 9 | + filters_config { |
| 10 | + input_strength = "HIGH" |
| 11 | + output_strength = "HIGH" |
| 12 | + type = "HATE" |
| 13 | + } |
| 14 | + filters_config { |
| 15 | + input_strength = "HIGH" |
| 16 | + output_strength = "HIGH" |
| 17 | + type = "INSULTS" |
| 18 | + } |
| 19 | + filters_config { |
| 20 | + input_strength = "HIGH" |
| 21 | + output_strength = "HIGH" |
| 22 | + type = "MISCONDUCT" |
| 23 | + } |
| 24 | + filters_config { |
| 25 | + input_strength = "NONE" |
| 26 | + output_strength = "NONE" |
| 27 | + type = "PROMPT_ATTACK" |
| 28 | + } |
| 29 | + filters_config { |
| 30 | + input_strength = "HIGH" |
| 31 | + output_strength = "HIGH" |
| 32 | + type = "SEXUAL" |
| 33 | + } |
| 34 | + filters_config { |
| 35 | + input_strength = "HIGH" |
| 36 | + output_strength = "HIGH" |
| 37 | + type = "VIOLENCE" |
| 38 | + } |
41 | 39 | } |
42 | 40 |
|
43 | 41 | # block / mask potential PII information |
44 | | - sensitive_information_policy_config = { |
45 | | - pii_entities_config = [ |
46 | | - { |
47 | | - action = "BLOCK" |
48 | | - type = "DRIVER_ID" |
49 | | - }, |
50 | | - { |
51 | | - action = "BLOCK" |
52 | | - type = "PASSWORD" |
53 | | - }, |
54 | | - { |
55 | | - action = "ANONYMIZE" |
56 | | - type = "EMAIL" |
57 | | - }, |
58 | | - { |
59 | | - action = "ANONYMIZE" |
60 | | - type = "USERNAME" |
61 | | - }, |
62 | | - { |
63 | | - action = "BLOCK" |
64 | | - type = "AWS_ACCESS_KEY" |
65 | | - }, |
66 | | - { |
67 | | - action = "BLOCK" |
68 | | - type = "AWS_SECRET_KEY" |
69 | | - }, |
70 | | - ] |
| 42 | + sensitive_information_policy_config { |
| 43 | + pii_entities_config { |
| 44 | + action = "BLOCK" |
| 45 | + type = "DRIVER_ID" |
| 46 | + } |
| 47 | + pii_entities_config { |
| 48 | + action = "BLOCK" |
| 49 | + type = "PASSWORD" |
| 50 | + } |
| 51 | + pii_entities_config { |
| 52 | + action = "ANONYMIZE" |
| 53 | + type = "EMAIL" |
| 54 | + } |
| 55 | + pii_entities_config { |
| 56 | + action = "ANONYMIZE" |
| 57 | + type = "USERNAME" |
| 58 | + } |
| 59 | + pii_entities_config { |
| 60 | + action = "BLOCK" |
| 61 | + type = "AWS_ACCESS_KEY" |
| 62 | + } |
| 63 | + pii_entities_config { |
| 64 | + action = "BLOCK" |
| 65 | + type = "AWS_SECRET_KEY" |
| 66 | + } |
71 | 67 | } |
72 | 68 |
|
73 | 69 | # block select word / profanity |
74 | | - word_policy_config = { |
75 | | - managed_word_lists_config = [{ |
| 70 | + word_policy_config { |
| 71 | + managed_word_lists_config { |
76 | 72 | type = "PROFANITY" |
77 | | - }] |
78 | | - } |
79 | | - |
80 | | - tags = [for k, v in local.combined_tags : |
81 | | - { |
82 | | - key : k, |
83 | | - value : v |
84 | 73 | } |
85 | | - ] |
| 74 | + } |
86 | 75 |
|
| 76 | + tags = local.combined_tags |
87 | 77 | } |
88 | 78 |
|
89 | | -resource "awscc_bedrock_guardrail_version" "runtask_fulfillment" { |
90 | | - guardrail_identifier = awscc_bedrock_guardrail.runtask_fulfillment.guardrail_id |
91 | | - description = "Initial version" |
| 79 | +resource "aws_bedrock_guardrail_version" "runtask_fulfillment" { |
| 80 | + guardrail_arn = aws_bedrock_guardrail.runtask_fulfillment.guardrail_arn |
| 81 | + description = "Initial version" |
92 | 82 | } |
0 commit comments