Skip to content

Instantly share code, notes, and snippets.

@npalm
Created May 13, 2021 14:56
Show Gist options
  • Save npalm/e5996934366ab2c077ade035cec300b5 to your computer and use it in GitHub Desktop.
Save npalm/e5996934366ab2c077ade035cec300b5 to your computer and use it in GitHub Desktop.
crossplane-composite-vpc
---
apiVersion: v1
kind: Secret
metadata:
name: aws-account-creds
namespace: crossplane-system
type: Opaque
data:
credentials: secret
---
apiVersion: aws.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
name: default
spec:
credentials:
source: Secret
secretRef:
namespace: crossplane-system
name: aws-account-creds
key: credentials
---
apiVersion: aws.crossplane.io/v1alpha3
kind: Provider
metadata:
name: aws-provider
spec:
credentialsSecretRef:
namespace: crossplane-system
name: aws-account-creds
key: credentials
region: eu-west-1
apiVersion: v1
kind: Namespace
metadata:
name: demo
---
apiVersion: vpc.aws.040code.nl/v1
kind: VPC
metadata:
name: my-vpc
namespace: demo
spec:
parameters:
name: composite-test
compositionSelector:
matchLabels:
provider: aws-provider
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: compositevpc.vpc.aws.040code.nl
labels:
provider: aws-provider
guide: blog
spec:
writeConnectionSecretsToNamespace: crossplane-system
compositeTypeRef:
apiVersion: vpc.aws.040code.nl/v1
kind: VPC
resources:
- name: vpc
base:
apiVersion: ec2.aws.crossplane.io/v1beta1
kind: VPC
spec:
forProvider:
region: eu-west-1
cidrBlock: 10.0.0.0/16
enableDnsHostNames: true
enableDnsSupport: true
tags:
- key: Name
value: vpc-template
providerConfigRef:
name: aws-provider
patches:
- fromFieldPath: "spec.parameters.name"
toFieldPath: "spec.forProvider.tags[0].value"
- fromFieldPath: "spec.parameters.cidrBlock"
toFieldPath: "spec.forProvider.cidrBlock"
---
apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
name: compositevpc.vpc.aws.040code.nl
spec:
group: vpc.aws.040code.nl
names:
kind: CompositeVPC
plural: compositevpc
claimNames:
kind: VPC
plural: vpc
versions:
- name: v1
served: true
referenceable: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
parameters:
type: object
properties:
name:
type: string
cidrBlock:
type: string
required:
- name
required:
- parameters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment