Exemplo n.º 1
0
    def get_target_resources(self, resources):
        """
        Get list of terraform targets arguments to be supplied to terraform command

        Args:
            resources (list): List of resources if there are targets else None

        Returns:
            targets (list / none): list of resources to be added as targets if there is any else None
        """
        if resources:
            targets = []
            for resource in resources:
                # DO NOT process this resource as its definiiton asked to skip
                if resource.PROCESS is False:
                    continue

                if BaseTerraformVariable not in inspect.getmro(
                        resource.__class__
                ) and TerraformData not in inspect.getmro(resource.__class__):
                    targets.append(get_terraform_resource_path(resource))

            return targets

        return None
Exemplo n.º 2
0
    def get_taint_resources(self, resources):
        taint_resources = []
        for resource in resources:
            if TerraformResource in inspect.getmro(resource.__class__):
                taint_resources.append(get_terraform_resource_path(resource))

        return taint_resources
Exemplo n.º 3
0
    def get_terraform_resource_path(cls):
        """
        Get path of the resource class

        Returns:
            path (str): path of the resource class
        """
        return get_terraform_resource_path(cls)
Exemplo n.º 4
0
    def get_target_resources(self, resources):
        if resources:
            targets = []
            for resource in resources:
                # DO NOT process this resource as its definiiton asked to skip
                if resource.PROCESS is False:
                    continue

                if BaseTerraformVariable not in inspect.getmro(resource.__class__) and TerraformData not in inspect.getmro(resource.__class__):
                    targets.append(get_terraform_resource_path(resource))

            return targets

        return None
Exemplo n.º 5
0
    def get_taint_resources(self, resources):
        """
        Get list of terraform resources to be tainted

        Args:
            resources (list): List of resources

        Returns:
            taint_resources (list): List of resources to be tainted
        """
        taint_resources = []
        for resource in resources:
            if TerraformResource in inspect.getmro(resource.__class__):
                taint_resources.append(get_terraform_resource_path(resource))

        return taint_resources
Exemplo n.º 6
0
    def get_target_resources(self, resources):
        """
        Get list of terraform targets arguments to be supplied to terraform command

        Args:
            resources (list): List of resources if there are targets else None

        Returns:
            targets (list / none): list of resources to be added as targets if there is any else None
        """
        if resources:
            targets = []
            for resource in resources:
                if BaseTerraformVariable not in inspect.getmro(resource.__class__) and TerraformData not in inspect.getmro(resource.__class__):
                    targets.append(get_terraform_resource_path(resource))

            return targets

        return None
Exemplo n.º 7
0
 def get_terraform_resource_path(cls):
     return get_terraform_resource_path(cls)