Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Import Existing Resources #66

@kferrone

Description

@kferrone

The Issue

The process of importing existing resources from a provider into a crossplane resource is quite tedious and a bit dangerous. The crossplane resource must match exactly all the properties to the existing resource from the provider. If the props don't exactly match; the resource will be modified to match what the crossplane resource says. If one were to accidentally omit a property then that property will be removed and/or set to its default instead of what it should be.

here are the docs on importing, which in my opinion are a little lite on the specifics: Crossplane Import Existing Resources

Suggested Solution

Would be nice to have the Crossplane CLI make the imported resource yaml for me.

I imagine a command like:
kubectl crossplane import aws vpc MyCoolVPC

The command would take a few different kinds of params like name, id, or ARN.
kubectl crossplane import aws vpc vpc-123abc456def

Then the generated output would be something like:

apiVersion: network.aws.crossplane.io/v1alpha3
kind: VPC
metadata:
  name: my-cool-vpc
  annotations:
    crossplane.io/external-name: vpc-someid
spec:
  cidrBlock: 10.100.0.0/16
  enableDnsHostNames: true
  enableDnsSupport: true
  reclaimPolicy: Retain
  tags:
    Name: MyCoolVPC
    "aws:cloudformation:logical-id": VPCA1B23C
    "aws:cloudformation:stack-id": "arn:aws:cloudformation:us-west-2:1234567:stack/MyStack/8f834j340"
    "aws:cloudformation:stack-name": MyStack
  providerRef:
    name: aws-provider

In the example above, if I were to forget to add the tags made by cloudformation, then the resource would get disassociated from the cloudformation stack and bad things would happen. Even worse, what if the cidrBlock was typed in wrong. . . Importing from the CLI would prevent a person from any dumb human mistakes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions