Exemplo n.º 1
0
    def setup(self):
        workspace = self.runner.get_service(
            self.resource.account.workspace,
            self.name
        )
        parent = self.runner.get_service(self.resource.parent, self.name)

        self.keypair = parent.aws.add_keypair(
            name=self.resource.name,
            private_key=workspace.project_config.add_string(
                name="secrets.keypair",
                default=expressions.rsa_private_key(),
                retain_default=True,
            )
        )

        self.vpc = parent.aws.add_vpc(
            name=self.resource.name,
            cidr_block=str(self.resource.cidr_block),
        )

        self.allocations = workspace.project_config.add_ip_allocations(
            name=self.resource.name + ".subnets",
            network=str(self.resource.cidr_block),
        )
 def test_dsa_private_key(self):
     serializer = expressions.rsa_private_key()
     self.assertTrue(isinstance(serializer, serializers.Expression))
     rendered = serializer.render(None, None).splitlines()
     self.assertEqual(
         rendered[0],
         "-----BEGIN RSA PRIVATE KEY-----",
     )
     self.assertEqual(
         rendered[-1],
         "-----END RSA PRIVATE KEY-----",
     )