|
| 1 | +import * as pulumi from "@pulumi/pulumi"; |
| 2 | +import * as stackit from "@stackitcloud/pulumi-stackit"; |
| 3 | + |
| 4 | +export const securityGroupProjectId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; |
| 5 | +export const securityGroupId = "security-group-id"; |
| 6 | +export const securityGroupRuleId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx1"; |
| 7 | + |
| 8 | +export const securityGroupName = "example-security-group-name"; |
| 9 | +export const securityGroupLabelKey = "unit-test"; |
| 10 | +export const securityGroupLabelValue = "test-label-value"; |
| 11 | +export const securityGroupProtocolName = "icmp"; |
| 12 | +export const securityGroupDirection = "ingress"; |
| 13 | +export const securityGroupStateful = false; |
| 14 | +export const securityGroupIcmpCode = 0; |
| 15 | +export const securityGroupIcmpType = 8; |
| 16 | + |
| 17 | +export const securityGroupRuleDescription = "description"; |
| 18 | +export const securityGroupRuleEtherType = "IPv4"; |
| 19 | +export const securityGroupRuleIpRange = "192.168.2.0/24"; |
| 20 | + |
| 21 | +// all set |
| 22 | +export const exampleSecurityGroupMax = new stackit.SecurityGroup("exampleSecurityGroupMax", { |
| 23 | + projectId: securityGroupProjectId, |
| 24 | + name: securityGroupName, |
| 25 | + labels: {[securityGroupLabelKey]:securityGroupLabelValue}, |
| 26 | + stateful: securityGroupStateful, |
| 27 | +}); |
| 28 | + |
| 29 | +// only required |
| 30 | +export const exampleSecurityGroupRuleReq = new stackit.SecurityGroupRule("exampleSecurityGroupRuleReq", { |
| 31 | + projectId: securityGroupProjectId, |
| 32 | + securityGroupId: securityGroupId, |
| 33 | + direction: securityGroupDirection, |
| 34 | +}); |
| 35 | + |
| 36 | +// SecurityGroupRule all set |
| 37 | +export const exampleSecurityGroupRuleMax = new stackit.SecurityGroupRule("exampleSecurityGroupRuleMax", { |
| 38 | + projectId: securityGroupProjectId, |
| 39 | + securityGroupId: securityGroupId, |
| 40 | + direction: securityGroupDirection, |
| 41 | + description: securityGroupRuleDescription, |
| 42 | + etherType: securityGroupRuleEtherType, |
| 43 | + ipRange: securityGroupRuleIpRange, |
| 44 | + icmpParameters: { |
| 45 | + code: securityGroupIcmpCode, |
| 46 | + type: securityGroupIcmpType, |
| 47 | + }, |
| 48 | + protocol: { |
| 49 | + name: securityGroupProtocolName, |
| 50 | + }, |
| 51 | +}); |
| 52 | + |
| 53 | +// datasource |
| 54 | +export const securityGroupDatasource = stackit.getSecurityGroupOutput({ |
| 55 | + projectId: securityGroupProjectId, |
| 56 | + securityGroupId: securityGroupId, |
| 57 | +}); |
| 58 | + |
| 59 | +export const securityGroupRuleDatasource = stackit.getSecurityGroupRuleOutput({ |
| 60 | + projectId: securityGroupProjectId, |
| 61 | + securityGroupId: securityGroupId, |
| 62 | + securityGroupRuleId: securityGroupRuleId, |
| 63 | +}); |
0 commit comments