Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #198 from haarchri/feature/ec2-sg-sgr
Browse files Browse the repository at this point in the history
feat(ec2-sg-sgr): added examples for securitygroup/rule ingress/egress
  • Loading branch information
muvaf authored Jul 25, 2022
2 parents 2b22626 + 4fdf61e commit 6165748
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 171 deletions.
24 changes: 10 additions & 14 deletions apis/ec2/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 0 additions & 37 deletions apis/ec2/v1alpha2/zz_generated.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions apis/ec2/v1alpha2/zz_securitygroup_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions config/ec2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ func Configure(p *config.Provider) {
p.AddResourceConfigurator("aws_security_group", func(r *config.Resource) {
r.Version = common.VersionV1Alpha2
r.ExternalName = config.IdentifierFromProvider
// Managed by SecurityGroupRule resource.
if s, ok := r.TerraformResource.Schema["ingress"]; ok {
s.Optional = false
s.Computed = true
}
// Managed by SecurityGroupRule resource.
if s, ok := r.TerraformResource.Schema["egress"]; ok {
s.Optional = false
s.Computed = true
}
r.References["egress.security_groups"] = config.Reference{
Type: "SecurityGroup",
RefFieldName: "SecurityGroupRefs",
Expand Down
14 changes: 14 additions & 0 deletions examples/ec2/securitygroup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: ec2.aws.jet.crossplane.io/v1alpha2
kind: SecurityGroup
metadata:
name: sample-sg
spec:
forProvider:
region: us-west-1
description: Cluster communication with worker nodes
name: sample-sg
vpcIdRef:
name: sample-vpc
providerConfigRef:
name: default
36 changes: 36 additions & 0 deletions examples/ec2/securitygrouprule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
apiVersion: ec2.aws.jet.crossplane.io/v1alpha2
kind: SecurityGroupRule
metadata:
name: sample-sgr
spec:
forProvider:
region: us-west-1
securityGroupIdRef:
name: sample-sg
type: ingress
protocol: tcp
fromPort: 443
toPort: 443
cidrBlocks:
- "172.16.0.0/16"
providerConfigRef:
name: default
---
apiVersion: ec2.aws.jet.crossplane.io/v1alpha2
kind: SecurityGroupRule
metadata:
name: sample-egress-sgr
spec:
forProvider:
region: us-west-1
securityGroupIdRef:
name: sample-sg
type: egress
protocol: "-1"
fromPort: 0
toPort: 0
cidrBlocks:
- "0.0.0.0/0"
providerConfigRef:
name: default
122 changes: 8 additions & 114 deletions package/crds/ec2.aws.jet.crossplane.io_securitygroups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,120 +65,6 @@ spec:
properties:
description:
type: string
egress:
items:
properties:
cidrBlocks:
items:
type: string
type: array
description:
type: string
fromPort:
type: number
ipv6CidrBlocks:
items:
type: string
type: array
prefixListIds:
items:
type: string
type: array
protocol:
type: string
securityGroupRefs:
items:
description: A Reference to a named object.
properties:
name:
description: Name of the referenced object.
type: string
required:
- name
type: object
type: array
securityGroupSelector:
description: A Selector selects an object.
properties:
matchControllerRef:
description: MatchControllerRef ensures an object with
the same controller reference as the selecting object
is selected.
type: boolean
matchLabels:
additionalProperties:
type: string
description: MatchLabels ensures an object with matching
labels is selected.
type: object
type: object
securityGroups:
items:
type: string
type: array
self:
type: boolean
toPort:
type: number
type: object
type: array
ingress:
items:
properties:
cidrBlocks:
items:
type: string
type: array
description:
type: string
fromPort:
type: number
ipv6CidrBlocks:
items:
type: string
type: array
prefixListIds:
items:
type: string
type: array
protocol:
type: string
securityGroupRefs:
items:
description: A Reference to a named object.
properties:
name:
description: Name of the referenced object.
type: string
required:
- name
type: object
type: array
securityGroupSelector:
description: A Selector selects an object.
properties:
matchControllerRef:
description: MatchControllerRef ensures an object with
the same controller reference as the selecting object
is selected.
type: boolean
matchLabels:
additionalProperties:
type: string
description: MatchLabels ensures an object with matching
labels is selected.
type: object
type: object
securityGroups:
items:
type: string
type: array
self:
type: boolean
toPort:
type: number
type: object
type: array
name:
type: string
namePrefix:
Expand Down Expand Up @@ -324,8 +210,16 @@ spec:
properties:
arn:
type: string
egress:
items:
type: object
type: array
id:
type: string
ingress:
items:
type: object
type: array
ownerId:
type: string
tagsAll:
Expand Down

0 comments on commit 6165748

Please sign in to comment.